正在启动jetty8 ClassNotFoundException:HttpServlet响应



为什么我的Jetty 8启动失败,HttpServlet响应出现ClassNotFoundException?我错过了哪一步?

在Ubuntu 12.04.03 上运行

我安装了openjdk 7与:

sudo apt-get安装openjdk-7-jdk

  • 已安装码头8,配备:

sudo apt-get安装jetty8

  • 修改/etc/default/jetty8文件以设置NO_START=0&JAVA_HOME=。。。值

但是,当我用"service jetty8 start"启动jetty时,它失败了,/var/log/start.log显示:

引起原因:java.lang.ClassNotFoundException:javax.servlet.http.HttpServlet响应

完整堆栈跟踪为:

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版本相匹配的实现。

相关内容

  • 没有找到相关文章

最新更新