Home > Mobile >  Resteasy Client Wildfly 23 - IncompatibleClassChangeError
Resteasy Client Wildfly 23 - IncompatibleClassChangeError

Time:01-05

I use Wildfly 23. I tried to implement a Resteasy Client (Version 4.7.0). Here is my code:

    ResteasyClient client = new ResteasyClientBuilderImpl().build();
    ResteasyWebTarget getEvent = client.target("https:......");
    Response getEventResponse = getEvent.request().get(); ...

But I get this error when "ResteasyClient client = new ResteasyClientBuilderImpl().build();" is invoked:

 Failed to define class org.jboss.resteasy.client.jaxrs.internal.ResteasyClientImpl in Module "deployment.isymnd.war" from Service Module Loader: java.lang.IncompatibleClassChangeError: Failed to link org/jboss/resteasy/client/jaxrs/internal/ResteasyClientImpl (Module "deployment.isymnd.war" from Service Module Loader): Implementing class

Does anyone has an idea what I am doing wrong? Thank you a lot, Nicole

CodePudding user response:

You're using a newer version of the client than WildFly 23 provides. WildFly 23 uses 3.15.1.Final. You should also ensure you're not including the JAR in your deployment.

CodePudding user response:

An alternative would be to use the JEE API for jaxrs client (especially as you are using Wildfly !)

Client client = ClientBuilder.newClient();

client.target(baseUri)
     .path("/users")
     .path(userId)
     .path("/roles")
     .request(MediaType.APPLICATION_XML)
     .post(...);

More info: https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/package-summary.html

  •  Tags:  
  • Related