调试时如何处理ClassNotLoadedException?

编程入门 行业动态 更新时间:2024-10-18 05:58:56
本文介绍了调试时如何处理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 );

...当我实际执行代码时,方块数组确实填满了 GridSquare 对象,当我执行代码和调试时,我会感到奇怪。在紧接着上述分配之后的断点上,如果我尝试查看 square 数组,而不是一个值,我得到这个:

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

发布评论

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

>www.elefans.com

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