RESTEasy Client + NoSuchMethodError

前端 未结 2 1226
萌比男神i
萌比男神i 2020-12-01 18:39

I am trying to write simple RESTEasy client. Below given is sample code:

Client client = ClientBuilder.newBuilder().build();
WebTarget target = client.target         


        
2条回答
  •  臣服心动
    2020-12-01 19:03

    At last after banging my head for couple of days, I could resolve these issues.


    Solution for issue 1:

    Error: "java.lang.NoSuchMethodError: org.jboss.resteasy.spi.ResteasyProviderFactory.(Lorg/jboss/resteasy/spi/ResteasyProviderFactory;)"

    Solution: I resolved this issue, by adding more resteasy modules in exclusion list inside jboss-deployment-structure.xml. My current state of jboss-deployment-structure.xml is as:

    
    
       
          
                
           
           
               
           
         
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
    
            
            
    
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
           
         
       
     
    

    I believe, it could have worked by simply excluding modules "org.jboss.resteasy.resteasy-jaxrs" and "org.jboss.resteasy.resteasy-cdi". But I did not try further as I faced another issue. You can try by removing un-necessary exclusions.

    Solution for issue 2:

    Error: "Caused by: java.lang.NoSuchMethodError: javax.ws.rs.core.Response.readEntity(Ljava/lang/Class;)Ljava/lang/Object;"

    Solution: JBOSS EAP 6.1, is bundled with default resteasy distribution. I downloaded latest resteasy jax-rs implementation (resteasy-jaxrs-3.0.7.Final-all.zip) from location.

    It comes with zip file called resteasy-jboss-modules-3.0.7.Final.zip. Unzip this file inside modules/system/layers/base/ directory of the JBoss EAP 6.1 distribution. This will overwrite some of the existing files there. This will resolve second issue.

    Hope this information would help others.

提交回复
热议问题