简体   繁体   English

从码头7升级到码头9

[英]Upgrading from jetty 7 to jetty 9

I'm running a Jetty 7 web application and would like to upgrade to jetty 9. The project is based on Spring framework and uses Maven for dependency management. 我正在运行Jetty 7 Web应用程序,并想升级到Jetty9。该项目基于Spring框架,并使用Maven进行依赖项管理。 Once I upgrade Jetty, it fails to start because of the following error: 升级Jetty后,由于以下错误,它无法启动:

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:473)
at org.eclipse.jetty.start.Main.start(Main.java:615)
at org.eclipse.jetty.start.Main.main(Main.java:96)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
at java.lang.Class.getConstructor0(Class.java:2803)
at java.lang.Class.newInstance(Class.java:345)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:348)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:296)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1262)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1197)
... 7 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
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:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 16 more

I have tried to identify dependencies that might cause conflicts with servlet-api, using the maven dependency tree tool but that didn't help much. 我已经尝试使用maven依赖关系树工具来确定可能与servlet-api发生冲突的依赖关系,但并没有太大帮助。 The error is still there. 错误仍然存​​在。

Currently running Jetty version 7.2.2.v20101205 and would like to upgrade to 9.1.3.v20140225. 当前正在运行Jetty版本7.2.2.v20101205,并且想要升级到9.1.3.v20140225。 NB. NB。 This error also occurs when upgrading Jetty to version 7.6.14.v20131031. 将Jetty升级到版本7.6.14.v20131031时也会发生此错误。 Basically any other version then the one I am using right now causes this error. 基本上我现在使用的任何其他版本都会导致此错误。

Any ideas? 有任何想法吗?

Jetty 9 is based on the Servlet container 3.0 version. Jetty 9基于Servlet容器3.0版本。 I guess your maven dependencies references the 2.5 or older version of the API 我猜您的Maven依赖项引用了2.5或更早版本的API

Prior to 3.0: 3.0之前的版本:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.5</version>
</dependency>

3.0.1 and upper: 3.0.1及更高版本:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.0.1</version>
</dependency>

我将开始检查webapp war中是否有任何与servlet-api相关的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM