Can't Resolve Clash for javax.ws.rs.core.Application.GetProperties

Answered

I was exploring IDEA Utlimate before purchase, built an application on my Fedora box, and then produced a WAR that I tried to deploy to tomcat8 on a Pi. The application works fine within the IDEA environment, but I run into a problem trying to get the right version of javax.ws.rs-api-2.0.jar included. I've explicitly added a version to my project that is version 2.0.1 of the API, and everything runs fine when I'm running it in the iDE. When I package up the WAR file and deploy it to the Pi running tomcat 8.0.29, I cannot start my package because it is somehow finding a 2.0 flavor of the API that lacks the Application.getProperties() method. I can accept that there is bundling on top of bundling on top of bundling here, but is there some way to get my web application to specify pulling jar files out of the provided lib files first? I see the right jar file in the exploded WAR, but somehow in the other environment I still end up with the wrong Jar being found first.


30-Dec-2015 15:43:20.852 SEVERE [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable
java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:271)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:298)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4969)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1703)
    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:744)


I feel like this is something I'm supposed to be able to control from the project somewhere, but I haven't been able to locate a working solution. Both machines are running Oracle JDK 1.8. I've installed tomcat on the Pi, but little else Java-oriented.

1
3 comments

It would help if you could share a sample project that would reproduce this problem.

0

same for me. use java 11 corretto. works ok from command line. fails when run from ide 20.
in idea 19 works ok.
use gradle.

0

java.lang.NoSuchMethodError usually indicates libraries incompatibilities. Check your project dependencies, there could be several versions of javax.ws.rs.core. You can us Navigate | Class action to see if there are several libraries for one class in project. Check also this thread about this error.

0

Please sign in to leave a comment.