调试ClassNotFoundException [英] Debugging a ClassNotFoundException

查看:150
本文介绍了调试ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我有一个包含对象和整数的嵌套类。这是为了标记子列表方法的开始和结束位置。

In my code, I have a nestted class that holds an object and an integer. This is to mark the beginning and end locations for a sublist method.

代码执行到对象和整数已建立值的点。我在调试器中对此进行了验证。

The code executes to the point that the object and integer have established values. I've verified this in the debugger.

下一行然后调用 ListLoc< E> startNode = new ListLoc< E>(start,startElement); ,这就是异常的原因。

The next line then calls ListLoc<E> startNode= new ListLoc<E>(start, startElement); and that is what trips the exception.

该类已被定义为

 private class ListLoc<E>{
    public Chunk<E> node;
    public int index;

    /* This object is created to hold a chunk and index location.  Two
     * objects will be created for the start and end locations for 
     * creating a sublist
     */
    public ListLoc(Chunk<E> node, int index){
        this.node= node;
        this.index= index;
    }
}

奇怪的是这部分代码正在执行在用全局变量替换本地startNode之前很好。这个想法没有用,所以我把变量改回来了,这个异常就出现了。

The strange thing is this portion of the code was executing fine before I replaced the local startNode with a global variable. That idea didn't work out, so I changed the variable back, and this exception cropped up.

我没有对类路径或执行做任何修改。唯一一次出现在调试器中

I have made no changes to the class path or executions. The only time this crops up is in the debugger

编辑:添加堆栈跟踪

ClassNotFoundException(Throwable)。(String,Throwable)line:217

ClassNotFoundException(Exception)。(String,Throwable)line:not available
ClassNotFoundException。(String)line:not available < br>
URLClassLoader $ 1.run()行:不可用

AccessController.doPrivileged(PrivilegedExceptionAction,AccessControlContext)行:不可用[native method]

Launcher $ ExtClassLoader( URLClassLoader).findClass(String)行:不可用

Launcher $ ExtClassLoader.findClass(String)行:不可用

Launcher $ ExtClassLoader(ClassLoader).loadClass(String,boolean) line:not available
Launcher $ AppClassLoader(ClassLoader).loadClass(String,boolean)line:not available
Launcher $ AppClassLoader.loadClass(String,boolean)line:not available

启动器$ AppClassLoader(ClassLoader).loadClass(String)行:不是ava ilable

ClassNotFoundException(Throwable).(String, Throwable) line: 217
ClassNotFoundException(Exception).(String, Throwable) line: not available ClassNotFoundException.(String) line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader.findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available

从我看来,它是触发异常的classLoader。

From what it looks to me, its the classLoader that triggers the exception.

推荐答案

如果您能澄清异常是什么会有所帮助,但是,我猜你得到的是一个ClassNotFound for E。

It would help if you could clarify what the exception is, however, I am guessing that you are getting a ClassNotFound for E.

它看起来像你的教授还没有澄清泛型的概念。我建议查看通用数据结构是什么。我给出的建议是寻找为什么没有定义E以及为什么要创建它们的列表。

It looks like your professor has not clarified the concept of Generics yet. I would recommend looking over what a generic data structure is. THe advice I would give is to look for why E is not defined and why you are trying to create a list of them.

我认为以下链接可能有助于澄清它们背后的语法和概念:
http:// download.oracle.com/javase/tutorial/extra/generics/index.html

I think that the following link might help to clarify the syntax and the concepts behind them: http://download.oracle.com/javase/tutorial/extra/generics/index.html

特别是以下部分: http://download.oracle.com/javase/tutorial/extra/generics/simple.html

这篇关于调试ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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