调试时如何处理 ClassNotLoadedException?

编程入门 行业动态 更新时间:2024-10-18 08:34:28
本文介绍了调试时如何处理 ClassNotLoadedException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我(远程)在 Eclipse 中调试一个 java/jboss 应用程序,逐行逐步调试.在某一时刻,通过方法调用创建了一组 GridSquare 对象(GridSquare 是一个相当简单的独立类,包含一些属性和方法),即:

So I'm (remotely) debugging a java/jboss application in Eclipse, stepping through line by line. At one point, an array of GridSquare objects (GridSquare is a fairly simple, standalone class, contains a few properties and methods) is created by a method call, i.e:

GridSquare[] squares = this.theGrid.getSquares(14, 18, 220, 222);

...虽然当我实际执行代码时,squares 数组确实填充了 GridSquare 对象,但在单步执行代码和调试时,我得到了一些奇怪的东西.在上面显示的赋值之后的行上的断点处,如果我尝试查看 squares 数组,而不是我得到的值:

...While when I actually execute the code, the squares array does get populated with GridSquare objects, I get something odd when stepping through the code and debugging. At a breakpoint on the line immediately following the assignment shown above, if I try to view the squares array, instead of a value I get this:

org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: 检索数组的组件类型时发生类型未加载.

...有人知道那是什么吗?

...Anyone know what that's about?

推荐答案

基本上就是类加载器没有加载 GridSquare[] 类.话虽如此,这在某种程度上听起来像是调试器中的错误.与代码的断点关联似乎略有中断.要么您需要重新编译以使行号同步,要么正在发生其他一些问题.在代码中的那个点(在赋值之后)它需要被加载.除非 getSquares 实际上返回一个子类 (GridSquareSubclass[]),此时 JVM 可能没有加载它,因为它(还)不需要它.

Basically it means the class loader has not loaded the GridSquare[] class. That being said it sounds like a bug in the debugger in some way. The breakpoint association with the code seems to be slightly broken. Either you need to recompile to get the line numbers in sync or some other issue is going on. At that point in the code (after the assignment) it needs to be loaded. Unless getSquares actually returns a subclass (GridSquareSubclass[]) at which point the JVM may not have loaded it because it doesn't need it (yet).

更多推荐

调试时如何处理 ClassNotLoadedException?

本文发布于:2023-11-26 22:58:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何处理   ClassNotLoadedException

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!