java.lang.NoSuchMethodError: 'java.util.Map javax.ws.rs.core.Application.getProperties() - Why I am getting this error in the server logs after deploying the code?
Hi There,
- I have migrated from jdk version 8 to JDK version 11 and in the server we installed new instance with java11 and tried to run the oslc/code from there.
- Changed the libraries from apache wink to glassfish jersey (v2.35).
- Updated the version of other maven dependencies to the latest.
- I am using Lyo version 5.0.0.
-
I have imported the libraries properly everywhere in my code, by removing apache wink.
Here is my POM.xml file :-
<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>oslc4j.services</groupId>
<artifactId>oslc4j-services</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>lyo-snapshots</id>
<name>Eclipse Lyo Snapshots</name>
<url>https://repo.eclipse.org/content/repositories/lyo-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
</repository
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<v.lyo>5.0.0.CR</v.lyo>
<v.jersey>2.35</v.jersey>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>2.1.2</version>
</dependency>
<!-- Thanks for using https://jar-download.com -->
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.clients</groupId>
<artifactId>oslc-client</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.clients</groupId>
<artifactId>oslc-java-client-resources</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version> <!-- Use the latest version -->
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version> <!-- Use the latest version -->
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.14.1</version> <!-- Use the latest version -->
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.classgraph/classgraph -->
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.90</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.wink/wink-common -->
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.35</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.35</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.35</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.connectors/jersey-apache-connector -->
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>2.35</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.media/jersey-media-multipart -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.35</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.oslc4j.core</groupId>
<artifactId>oslc4j-core</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.oslc4j.core</groupId>
<artifactId>oslc4j-jena-provider</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.oslc4j.core</groupId>
<artifactId>oslc4j-json4j-provider</artifactId>
<version>${v.lyo}</version>
<exclusions>
<exclusion>
<groupId>org.apache.wink</groupId>
<artifactId>wink-json4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.lyo.clients/oslc4j-client -->
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-core</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-consumer-store</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-webapp</artifactId>
<version>${v.lyo}</version>
<type>war</type>
</dependency>
-
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-core</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-consumer-store</artifactId>
<version>${v.lyo}</version>
</dependency>
<dependency>
<groupId>org.eclipse.lyo.server</groupId>
<artifactId>oauth-webapp</artifactId>
<version>${v.lyo}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
</dependencies>
After deploying the code in the server with these changes I am getting the following error after hitting the endpoint URL in the REST API client :- [ERROR] SRVE0271E: Uncaught init() exception created by servlet [JAX-RS Servlet] in application [oslc4j-services]: java.lang.NoSuchMethodError: 'java.util.Map javax.ws.rs.core.Application.getProperties()' at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:311) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:232) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:296) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:261) at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:347) at javax.servlet.GenericServlet.init(GenericServlet.java:161) at [internal classes] at org.eclipse.lyo.oslc4j.enovia.servlet.CredentialsFilter.doFilter(CredentialsFilter.java:42) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:203) at [internal classes]
I've searched online and it says it has something to do with Jersey v1 and v2 conflicting with each other. But later I had checked in my local as well as in the runtime server, there is no mismatch between them.How do I get rid of this error?
One answer
I am sorry, but I don't think anyone here in this forum can help here.
- Neither Lyo nor Jersey are part of the product.
- There is no source code here that anyone could look at.
- There is no information what the extension does, where it is deployed, how and why.
- There are no version information for ELM products - note that prior to 7.0.3 there is no support for Java 11. Look into the system requirements for details.