为什么我的Jetty 8启动失败并显示ClassNotFoundException来响应HttpServlet?我错过了哪一步?
在Ubuntu 12.04.03上运行
我安装了openjdk 7:
须藤apt-get install openjdk-7-jdk
已安装的码头8:
须藤apt-get install jetty8
修改了/ etc / default / jetty8文件以设置NO_START = 0和JAVA_HOME = ...值。
但是,当我用“ service jetty8 start”启动码头时,它失败了,/ var / log / start.log显示:
引起原因:java.lang.ClassNotFoundException:javax.servlet.http.HttpServletResponse
完整的堆栈跟踪为:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
at org.eclipse.jetty.start.Main.start(Main.java:602)
at org.eclipse.jetty.start.Main.main(Main.java:82)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletResponse
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getConstructor0(Class.java:2793)
at java.lang.Class.newInstance(Class.java:345)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:333)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:291)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1203)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
... 7 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletResponse
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more
Usage: java -jar start.jar [options] [properties] [configs]
java -jar start.jar --help # for more information
最佳答案
试试这个版本:
sudo apt-get install libservlet3.0-java
您需要获取与您的servlet-api版本匹配的实现。