Jersey 2.1 + JBoss 7.1 NoSuchMethodError: getProperties
I am trying to run Jersey 2.1 REST service on JBoss 7.1 AS. I am getting
the NoSuchMethodError: javax.ws.rs.core.Application.getProperties error
during deployment:
ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RESTService]]
(MSC service thread 1-9) StandardWrapper.Throwable:
java.lang.NoSuchMethodError:
javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
at
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:271)
[jersey-server-2.1.jar:]
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:283)
[jersey-container-servlet-core-2.1.jar:]
In pom.xml I have:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.1</version>
</dependency>
And in the web.xml:
<servlet>
<servlet-name>RESTService</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.gatekeeper.restservice.RESTApplication</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Previously I tried with Jersey 1.17.1 and it worked (after disabling
resteasy scan and jaxrs extension/subsystem in JBoss). So far I've found
one similar post (but with Tomcat) where the conslusion was that the wrong
javax.ws.rs.core.Application is being bound at runtime, and further that
the bound class is an "old" (JAX-RS 1.1) version.
Any help how to resolve this? I'm .net guy and I'm totally blind in java
:) Thanks Bartek
exclude jersey-*-1.x.x in maven dependencies...
ReplyDelete