最近,准备把一个Eclipse转到IDEA下,转移完毕之后,在启动的时候报错了,具体如下:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector
at com.jfinal.server.ServerFactory.getServer(ServerFactory.java:44)
at com.jfinal.core.JFinal.start(JFinal.java:161)
at com.RunEovaOSS.main(RunEovaOSS.java:14)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Connector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
比较纳闷,在Eclipse下是正常启动的,于是百度了下,解决java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector的方法也很简单,来到maven配置文件pom.xml下,把jetty的scope改成compile的就行了。
<dependency> <groupId>com.jfinal</groupId> <artifactId>jetty-server</artifactId> <version>8.1.8</version> <scope>compile</scope> </dependency>