1

Conventional wisdom seems to indicate that this error I am getting:

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

Is the result of a collision between JAX-RS versions, however, I’m at a loss as to how to systematically locate where the collision might be happening. Although this problem seemingly popped up spontaneously after having gone a year or so since compiling/running the app, I must have faced something similar in the past because what I understand to be attempted invocations are already excluded (I think) in my pom.xml. I’m obviously missing something - but I’m falling short in my debug attempts. I played with mvn tree and got this:

$ mvn dependency:tree -Dverbose -Dincludes=javax.ws.rs
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< edu.mayo.ima.directory:MDS-Committee-WS >---------------
[INFO] Building MDS-Committee-WS 1.0.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ MDS-Committee-WS ---
[INFO] edu.mayo.ima.directory:MDS-Committee-WS:war:1.0.0
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.26:compile
[INFO] |  +- org.glassfish.jersey.core:jersey-server:jar:2.26:compile
[INFO] |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.26:compile
[INFO] |  |  |  \- (javax.ws.rs:javax.ws.rs-api:jar:2.1:compile - omitted for duplicate)
[INFO] |  |  \- (javax.ws.rs:javax.ws.rs-api:jar:2.1:compile - omitted for duplicate)
[INFO] |  \- javax.ws.rs:javax.ws.rs-api:jar:2.1:compile
[INFO] +- org.glassfish.jersey.core:jersey-common:jar:2.26:compile
[INFO] |  \- (javax.ws.rs:javax.ws.rs-api:jar:2.1:compile - omitted for duplicate)
[INFO] +- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.23.2:compile
[INFO] |  \- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.23.2:compile
[INFO] |     \- (javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile - omitted for conflict with 2.1)
[INFO] \- io.swagger:swagger-jaxrs:jar:1.5.0:compile
[INFO]    \- javax.ws.rs:jsr311-api:jar:1.1.1:compile

I’m confused because several of the items above listed with “compile” I would have thought were excluded in my pom.xml (below), e.g.,

javax.ws.rs:javax.ws.rs-api:jar:2.1:compile javax.ws.rs:jsr311-api:jar:1.1.1:compile

So my overall objective is the exclude what redundancy is causing the problem, but I need help/suggestions on isolating the culprits. If anyone has the time and inclination, I'd like to hear about recommended systematic ways/tools for approaching something like this. In any case, thanks in advance for anything you can offer. Here's my pom.xml.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>edu.mayo.ima.directory</groupId>
  <artifactId>MDS-Committee-WS</artifactId>
  <packaging>war</packaging>
  <version>1.0.0</version>
  <name>MDS-Committee-WS</name>
  <url>http://maven.apache.org</url>
<distributionManagement>
<repository>
  <id>ComOpSys</id>
  <url>https://pkgs.dev.azure.com/mclm/_packaging/ComOpSys/maven/v1</url>
  <!--<releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots> -->
</repository>
</distributionManagement>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <!--<dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-servlet-core</artifactId>
    </dependency> -->
    <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-servlet-core</artifactId>
      <version>2.26</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-common</artifactId>
      <version>2.26</version>
      <exclusions>
        <exclusion>
          <groupId>javax.ws.rs</groupId>
          <artifactId>jsr311-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
        <version>2.26</version>
    </dependency>
    <!--<dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
      <version>1.19.4</version>
      <exclusions>
        <exclusion>
          <groupId>javax.ws.rs</groupId>
          <artifactId>jsr311-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency> -->
<dependency>
  <groupId>com.sybase.jdbc4</groupId>
  <artifactId>jdbc</artifactId>
  <version>7.0</version>
</dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20170516</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>3.9.1</version>
    </dependency>
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt</artifactId>
      <version>0.6.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-jaxrs</artifactId>
      <version>1.5.0</version>
    </dependency>
  </dependencies>
<repositories>
<repository>
  <id>ComOpSys</id>
  <url>https://pkgs.dev.azure.com/mclm/_packaging/ComOpSys/maven/v1</url>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>
<repository>
  <id>mclm@Local</id>
  <url>https://pkgs.dev.azure.com/mclm/_packaging/mclm%40Local/maven/v1</url>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>
</repositories>
    <properties>
        <jersey.version>2.23.2</jersey.version>
    </properties>
  <build>
    <!-- <finalName>MDS-Committee-WS</finalName> -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>3.0.0</version>
      <configuration>
        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
      <!-- <failOnMissingWebXml>false</failOnMissingWebXml> -->
        <webResources>
          <resource>
            <directory>
              src/main/webapp
            </directory>
          </resource>
        </webResources>
      </configuration>
      </plugin>
      <!-- <plugin>
        <groupId>com.sebastian-daschner</groupId>
        <artifactId>jaxrs-analyzer-maven-plugin</artifactId>
        <version>0.14</version>
        <executions>
          <execution>
            <goals>
              <goal>analyze-jaxrs</goal>
            </goals>
            <configuration>
              <backend>swagger</backend>
            </configuration>
          </execution>
        </executions>
      </plugin> -->
    </plugins>
      <sourceDirectory>${basedir}/src/main/webapp</sourceDirectory>
      <defaultGoal>install</defaultGoal>
  </build>
</project>
Tiggyboo
  • 522
  • 6
  • 14
  • 1
    Remove `jsr311-api` and use [this swagger dependency](https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5) instead. – Paul Samsotha Dec 04 '20 at 01:00
  • Thanks, but that didn't work. Pulling my hair out trying to find old Jersey dependencies, but with no luck. Nothing explicit, at least in my tree: – Tiggyboo Dec 09 '20 at 23:20
  • Did you remove the old swagger dependency and did you clean the project? There's nothing else that could cause this error exact error unless you are running on glassfish server. – Paul Samsotha Dec 10 '20 at 08:20
  • 1
    I failed to do the clean - did that, re-identified the artifacts and it took worked. Appreciate you time and feedback, Paul! – Tiggyboo Dec 10 '20 at 21:51

0 Answers0