1
votes

I'm using Jersey 1.8 currently with Jersey Spring plugins 1.8 using JBoss EAP 6.3 and it's working fine with JDK 1.6. Now while upgrading to JDK 1.8 and JBoss EAP 6.4 the Jersey 1.0 is not supported while binding the response [1] . After which I have upgraded the Jersey and Jersey+Spring version to 2.4.1 [2] however I'm getting the "exception: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;" error while starting of the server. Can someone please let me know how to resolve this issue or any other possible solution to implement with this JDK 1.8 migration?

  1. Tried checking mvn dependency:tree and removed jsr311-api jar from axis2-transport-local jar but still getting the method not found error [3]
  2. Tried comment out the resources configured in "/jboss-eap-6.4\modules\system\layers\base\javax\ws\rs\api\main\module.xml" [5] and got module not found error during start of the server. Even if this works not sure it's the right approach to do.

    [1] Binding Error JDK 1.8 and Jersey 1.8

    20:01:12,484 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/tst02].[jersey-serlvet]] (ajp-/10.78.180.83:9109-14) JBWEB000236: Servlet.service() for servlet jersey-serlvet threw exception: java.lang.AbstractMethodError at org.codehaus.jackson.map.AnnotationIntrospector$Pair.findSerializer(AnnotationIntrospector.java:1148) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ser.BasicSerializerFactory.findSerializerFromAnnotation(BasicSerializerFactory.java:366) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:252) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:782) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4] at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:735) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4]

    [2] Error After upgrading to Jersey and Jersey+Spring version with 2.4.1

    06:12:53,208 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/tst01]] (ServerService Thread Pool -- 113) JBWEB000289: Servlet jersey-serlvet threw load() exception: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:272) [jersey-server-2.4.1.jar:] at org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:302) [jersey-container-servlet-core-2.4.1.jar:] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167) [jersey-container-servlet-core-2.4.1.jar:] at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349) [jersey-container-servlet-core-2.4.1.jar:] at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3593) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3802) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1] at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_151] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_151] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_151] at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151] at org.jboss.threads.JBossThread.run(JBossThread.java:122)

    [4] POM.xml Maven Dependencies for our module

    <dependency>
    <groupId>org.glassfish.jersey.ext</groupId>
    <artifactId>jersey-spring3</artifactId>
    <version>2.4.1</version>
    <exclusions>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    </exclusion>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    
    <dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-json-jackson</artifactId>
    <version>2.4.1</version>
    </dependency>
    <dependency>
    <groupId>org.glassfish.jersey.media</groupId>
    <artifactId>jersey-media-multipart</artifactId>
    <version>2.4.1</version>
    </dependency>
    <dependency>
    <groupId>org.jboss.spec.javax.ws.rs</groupId>
    <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
    <version>1.0.0.Final</version>
    </dependency>
    

    [5] JBoss module.xml -->

    <dependencies>
    <module name="org.jboss.resteasy.resteasy-jaxrs" services="export"/>
    </dependencies>
    </module>
    
1

1 Answers

0
votes

Looks to me like you might need to add a jboss-deployment-structure.xml descriptor file (see here for further reading) to exclude the JAX-RS 1.0 dependency added to your classpath by JBoss modules. I had a similar problem which was fixed by adding the following file to the META-INF directory in my EAR:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<sub-deployment name="TheWar.war">
    <dependencies>
        <module name="javax.jws.api" /> <!-- Required due to exclusion of javaee.api below -->
        <module name="javax.servlet.api" /> <!-- Required due to exclusion of javaee.api below -->
        <module name="javax.xml.ws.api" /> <!-- Required due to exclusion of javaee.api below -->
    </dependencies>
    <exclude-subsystems>
        <subsystem name="jaxrs" />
        <subsystem name="resteasy" />
        <subsystem name="webservices" />
    </exclude-subsystems>
    <exclusions>
        <module name="javaee.api" /> <!-- Exclude as it brings in dependency on JAX-RS 1.0 -->
        <module name="javax.ws.rs.api"/> <!-- Exclude as it brings in dependency on JAX-RS 1.0 -->
        <module name="org.jboss.resteasy.resteasy-jaxrs" /> <!-- Exclude as it brings in dependency on JAX-RS 1.0 -->
        <module name="org.jboss.as.jaxrs" /> <!-- Exclude as it brings in dependency on JAX-RS 1.0 -->
    </exclusions>
</sub-deployment>