java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;

The Application#getProperties() method was introduced in JAX-RS 2.0. And this error typically happens when you mix JAX-RS 1.x and JAX-RS 2.x.

So check the JARs on your classpath and remove everything that relates to JAX-RS 1.x (and Jersey 1.x).

Once you are using Maven, you can run mvn dependency:tree and check what’s going on with your dependencies.


I also see a few things that may cause some headaches:

  1. See below the correct Servlet API dependency for Tomcat 8 (don’t forget the provided scope):

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.1</version>
        <scope>provided</scope>
    </dependency>
    
  2. Ensure that all Jersey dependencies use the same version.

  3. You probably don’t need the javax.ws.rs-api, jersey-server and jersey-common dependencies.

    • Use jersey-container-servlet, jersey-media-json-jackson and jersey-media-multipart dependencies.

    • The jersey-container-servlet dependency uses javax.ws.rs-api,
      jersey-server and jersey-common as transitive dependencies.

  4. You probably don’t need <type>jar</type> in your dependencies.

Leave a Comment