使用Apache Commons VFS时,为什么我的applet中会出现NoClassDefFoundError?

时间:2011-05-22 21:26:31

标签: java applet noclassdeffounderror

任何人都可以帮我理解这个错误信息吗? 我写了一个拖放小程序,它通过SFTP上传到远程服务器。它从我的本地计算机运行applet时有效,但是一旦我把它放在网上,我就会收到以下错误。

原因是什么,我该怎么办?

Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/commons/vfs/FileSystemException
    at com.zehon.sftp.SFTP.getSFTPClient(SFTP.java:20)
    at com.zehon.sftp.SFTP.sendFile(SFTP.java:50)
    at Combined.uploadFunction(Combined.java:103)
    at NewDrag.uploadButtonMouseClicked(NewDrag.java:187)
    at NewDrag.access$400(NewDrag.java:35)
    at NewDrag$5.mouseClicked(NewDrag.java:137)
    at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.vfs.FileSystemException
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 37 more

1 个答案:

答案 0 :(得分:2)

看起来你没有嵌入commons-vfs作为applet中的依赖项。

如果您使用maven构建支票How to deploy Applet with dependencies jar using maven and sign it?以获取有关如何使用maven的帮助。