我有一个maven项目,它生成一个.war
应用程序。当我在本地安装的jetty9中部署此战争时,应用程序正常运行。当我在AWS中部署到我的机器时,它无法启动以下错误。
2017-07-05 17:53:43.336:WARN:oejuc.AbstractLifeCycle:main: FAILED o.e.j.w.WebAppContext@3dd3bcd{/my-app,file:/var/cache/jetty9/data/jetty-0.0.0.0-8080-my-app.war-_my-app-any-5436545420435013189.dir/webapp/,STARTING}{/my-app.war}: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:331)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
这是一个Jersey 2应用程序,它通过泽西岛1编写的旧客户端与另一个api进行通信。我已经在两个版本的Jersey之间发生了冲突,并使用maven exclusions作为indicated here来解决它们,并解决了问题在本地,但由于某种原因,我在部署时失败了。
我没有发现两种环境之间的差异。我跑了java -jar /usr/share/jetty9/start.java --version
,结果在两台机器上都是相同的(我把它差异化了):
Jetty Server Classpath:
-----------------------
Version Information on 38 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
changes to the --module=name command line options will be reflected here.
0: (none specified) | ${jetty.home}/eclipse-ecj-3.11.0.jar
1: 9.2.18.v20160721 | ${jetty.home}/jetty9-apache-jsp.jar
2: 1.2.5 | ${jetty.home}/taglibs-standard-impl.jar
3: 1.2.5 | ${jetty.home}/taglibs-standard-spec.jar
4: 8.0.37 | ${jetty.home}/tomcat8-api-8.0.37.jar
5: 3.0.FR | ${jetty.home}/tomcat8-el-api-8.0.37.jar
6: 8.0.37 | ${jetty.home}/tomcat8-jasper-8.0.37.jar
7: 8.0.37 | ${jetty.home}/tomcat8-jasper-el-8.0.37.jar
8: 2.3.FR | ${jetty.home}/tomcat8-jsp-api-8.0.37.jar
9: 8.0.37 | ${jetty.home}/tomcat8-juli-8.0.37.jar
10: 8.0.37 | ${jetty.home}/tomcat8-util-8.0.37.jar
11: 8.0.37 | ${jetty.home}/tomcat8-util-scan-8.0.37.jar
12: (dir) | ${jetty.base}/resources
13: 3.1.FR | ${jetty.home}/servlet-api-3.1.jar
14: 9.2.18.v20160721 | ${jetty.home}/jetty9-http.jar
15: 9.2.18.v20160721 | ${jetty.home}/jetty9-server.jar
16: 9.2.18.v20160721 | ${jetty.home}/jetty9-xml.jar
17: 9.2.18.v20160721 | ${jetty.home}/jetty9-util.jar
18: 9.2.18.v20160721 | ${jetty.home}/jetty9-io.jar
19: 9.2.18.v20160721 | ${jetty.home}/jetty9-jndi.jar
20: 1.5.6 | ${jetty.home}/javax.mail.jar
21: 9.2.18.v20160721 | ${jetty.home}/jetty9-security.jar
22: 9.2.18.v20160721 | ${jetty.home}/jetty9-servlet.jar
23: 9.2.18.v20160721 | ${jetty.home}/jetty9-webapp.jar
24: 9.2.18.v20160721 | ${jetty.home}/jetty9-deploy.jar
25: 9.2.18.v20160721 | ${jetty.home}/jetty9-plus.jar
26: 9.2.18.v20160721 | ${jetty.home}/jetty9-annotations.jar
27: 3.0.FR | ${jetty.home}/tomcat8-annotations-api-8.0.37.jar
28: 5.1 | ${jetty.home}/asm-commons-5.1.jar
29: 5.1 | ${jetty.home}/asm-5.1.jar
30: 1.1.FR | ${jetty.home}/tomcat8-websocket-api-8.0.37.jar
31: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-client-impl.jar
32: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-server-impl.jar
33: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-api.jar
34: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-client.jar
35: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-common.jar
36: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-server.jar
37: 9.2.18.v20160721 | ${jetty.home}/jetty9-websocket-servlet.jar
我的问题是:可能导致此错误的AWS计算机有什么不同?我还应该在哪里获得更多信息来解决这个问题?
答案 0 :(得分:0)
显然,排除项未正确配置。我排除了com.sun.jersey:jersey-server
,但javax.ws.rs:jsr311-api
被列为com.sun.jersey:jersey-client
的传递依赖项。我明确排除javax.ws.rs:jsr311-api
并且它有效。
我仍然不知道为什么它在我当地的码头安装工作。一位队友建议我可能与每台机器上加载的罐子的订单有关,但我不确定如何检查。