2017 06 05 10:34:47#+0300#ERROR#org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]##anonymous#localhost-startStop-1#na###web##StandardWrapper.Throwablejava.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:390)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:172)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:364)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:805)
我猜有时它会得到不同的依赖关系而没有.getProperties()方法,但我如何选择每次使用哪一个
答案 0 :(得分:1)
您的类路径或类路径中包含哪个版本的JAX-RS jar包含JAX-RS 1(jsr311-api.jar
)和JAX-RS 2(javax.ws.rs-api-2.0.1.jar
)jar.If在您的类路径中让jsr311-api.jar
为JAX-RS 1. jsr311-api.jar
没有方法getProperties()
因此你得到NoSuchMethodError
。在你的类路径中使用javax.ws.rs-api-2.0.1.jar
它将解决您的问题。