gpt4 book ai didi

java - 使用 Apache Commons VFS 时,为什么我的小程序中会出现 NoClassDefFoundError?

转载 作者:行者123 更新时间:2023-12-02 08:17:24 26 4
gpt4 key购买 nike

谁能帮我理解这个错误消息?我编写了一个拖放小程序,它通过 SFTP 上传到远程服务器。当我从本地计算机运行小程序时它可以工作,但是一旦我将其放到网上,我就会收到以下错误。

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

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

最佳答案

看起来您还没有将 commons-vfs 作为依赖项嵌入到您的小程序中。

如果您使用maven进行构建检查How to deploy Applet with dependencies jar using maven and sign it?获取有关如何使用 Maven 执行此操作的帮助。

关于java - 使用 Apache Commons VFS 时,为什么我的小程序中会出现 NoClassDefFoundError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6090896/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com