mrzhqiang / ms079

冒险岛 v079 版本,源码来自网络,本仓库作为研究学习用途。
126 stars 82 forks source link

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/mina/core/service/IoHandlerAdapter #9

Closed jcc563768606 closed 3 years ago

jcc563768606 commented 3 years ago

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/mina/core/service/IoHandlerAdapter at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at server.Start.startServer(Start.java:234) at gui.ZlhssMS.jButton10ActionPerformed(ZlhssMS.java:774) at gui.ZlhssMS.access$000(ZlhssMS.java:40) at gui.ZlhssMS$1.actionPerformed(ZlhssMS.java:134) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(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.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.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.mina.core.service.IoHandlerAdapter at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 52 more

mrzhqiang commented 3 years ago

如何触发这一次异常呢?

jcc563768606 commented 3 years ago

打包之后,运行gui.bat

jcc563768606 commented 3 years ago

三方包没有在maven打包的时候一起打进来

jcc563768606 commented 3 years ago

我不知道怎么样才能正确打包,放到linux上跑起来,现在我把打出来的ms079-1.0-SNAPSHOT-dist.zip解压到服务器上,报错就是少了第三方jar

jcc563768606 commented 3 years ago

可能是我的sh写的有问题?我看其他的bat语句都没啥用,就写了一句java -cp ms079-1.0-SNAPSHOT.jar server.Start这个,然后就会报错 [DB信息] Could not locate the JDBC mysql driver. Exception in thread "main" java.lang.ExceptionInInitializerError at server.Start.main(Start.java:51) Caused by: java.lang.UnsupportedOperationException: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ms079?characterEncoding=UTF-8&autoReconnect=true at database.DatabaseException.(DatabaseException.java:38) at database.DatabaseConnection.connectToDB(DatabaseConnection.java:110) at database.DatabaseConnection.getConnection(DatabaseConnection.java:32) at server.ServerProperties.(ServerProperties.java:38) ... 1 more Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ms079?characterEncoding=UTF-8&autoReconnect=true at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:247) at database.DatabaseConnection.connectToDB(DatabaseConnection.java:97) ... 3 more

mrzhqiang commented 3 years ago

你看你需要重新打包,使用 clean + package 打包出来新的压缩包。解压到全新的文件夹。 我刚才试了,会识别到第三方包。

jcc563768606 commented 3 years ago

你能截图给我看一下你zip解压出来之后是怎么个文件结构吗,能运行吗,或者你帮忙给我写一个sh命令好吗

mrzhqiang commented 3 years ago

image

jcc563768606 commented 3 years ago

可以用了,感恩