调试时如何处理 ClassNotLoadedException? [英] How do I deal with a ClassNotLoadedException while debugging?

查看:53
本文介绍了调试时如何处理 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆