JBoss EAP6: Upgrade to RESTEasy3.x

Tuesday 01 July 2014

We need to tell JBoss that we don’t want the default JAX-RS 1.1 to be loaded but our own implementation. For this we have to:

  • Disable the default JAX-RS subsystem
  • Exclude the javaee.api module which contains all JEE6 apis
  • Manually add all JEE6-apis except the javax.ws.rs.api api

The WEB-INF/jboss-deployment-structure.xml looks like this:

java encoding 3


That’s it! almost…
Almost there
If you put the JAX-RS annotations (like @Path) directly on your resource implementations the work done above should be sufficient.
In my case it didn’t work. In my project we have an api- and a implementation project. This because we want to use the interfaces on client side with the proxy client feature of RESTEasy. This way we don’t have to care much about building REST urls and parameters. So, we have our interfaces which are annotated with JAX-RS stuff. The implementation is completely JAX-RS free and only uses CDI/EJB annotations. In this constellation RESTEasy wasn’t able to find all classes involved. Looks like the automatic scanning (that used to work in RESTEasy 2) doesn’t work anymore. I think this might be a bug but maybe we’re missing something.

As a workaround you can register all resource classes (the implementations) and exception mappers manually in your rest application class:

java encoding 4

That did the trick!

I hope that others find this post useful. We wasted several days on this.

And please let me know if there’s a solution for the class scanning issue. Thanks!