REST JAX-RS javax.ws.rs.ProcessingException:

后端 未结 3 1382
名媛妹妹
名媛妹妹 2021-01-02 04:54

I am getting below exception whenever my REST client code makes a call to the REST service using below code: Code:

public void putWatcher(Wa         


        
相关标签:
3条回答
  • 2021-01-02 05:22

    I recently bumped into this problem. It was caused by a library providing an old implementation of javax.ws.rs.core. I fixed it as follows:

        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxws</artifactId>
            <version>1.6.2</version>
            <scope>runtime</scope>
            <exclusions>
                <!-- Causes java.lang.NoSuchMethodError: javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family; -->
                <exclusion>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    
    0 讨论(0)
  • 2021-01-02 05:29

    Can you take a look at libraries catalogue of your JBoss instance and remove all implementations of JAX-WS? To me it seems they conflict with the Jersey you bundle in your WAR-file.

    Edit:

    Actually I guess you need to resolve JAX-WS version conflict between your server and web application. Method familyOf you are missing in Response.Status.Family was introduced in Java 7 but is missing from Java EE 6. So find Java EE 6 compatible Jersey version or upgrade the server.

    And if later Maven will cause problems, then for the real kick, there's also

    mvn dependency:tree
    

    and

    <dependency>
    ...
            <exclusions>
                <exclusion>...</exclusion>
    
    0 讨论(0)
  • 2021-01-02 05:34

    I encountered a similar error. "java.lang.NoSuchMethodError: javax/ws/rs/ClientErrorException.validate(Ljavax/ws/rs/core/Response;Ljavax/ws/rs/core/Response$Status$Family;"

    Root cause: web service performance tester invoke the web service using script without passing in correct request body. missing a "/" in the path url of web service call is another case.

    when you see this validation error, that means some major error already happened, this noSuchMethodError is only a minor byproduct when handling the major error.

    0 讨论(0)
提交回复
热议问题