Custom JAX-RS providers aren't recognised in EAP 6
Issue
- We implemented a custom JAX-RS provider to convert HTTP body to objects.
- However, this provider isn't recognised by JBoss EAP when it's deployed as a JAR, whereas the same provider is recognised successfully when it's expanded under
classes/. - We use Jersey as the JAX-RS implementation instead of RESTEasy.
- Here is the log when it's deployed as a JAR:
12:59:47,241 INFO [com.sun.jersey.api.core.PackagesResourceConfig] (ServerService Thread Pool -- 73) Scanning for root resource and provider classes in the packages:
com.example.myproject.providers
org.codehaus.jackson.jaxrs
12:59:47,324 INFO [com.sun.jersey.spi.spring.container.servlet.SpringServlet] (ServerService Thread Pool -- 73) Using default applicationContext
12:59:47,330 INFO [com.sun.jersey.spi.spring.container.SpringComponentProviderFactory] (ServerService Thread Pool -- 73) Registering Spring bean, myService, of type com.example.myproject.services.MyService as a root resource class
- Here is the log when it's expanded under
classes/:
13:02:03,021 INFO [com.sun.jersey.api.core.PackagesResourceConfig] (ServerService Thread Pool -- 54) Scanning for root resource and provider classes in the packages:
com.example.myproject.providers
org.codehaus.jackson.jaxrs
13:02:03,059 INFO [com.sun.jersey.api.core.ScanningResourceConfig] (ServerService Thread Pool -- 54) No root resource classes found.
13:02:03,059 INFO [com.sun.jersey.api.core.ScanningResourceConfig] (ServerService Thread Pool -- 54) Provider classes found:
class com.example.myproject.providers.MyFirstProvider
class com.example.myproject.providers.MySecondProvider
13:02:03,110 INFO [com.sun.jersey.spi.spring.container.servlet.SpringServlet] (ServerService Thread Pool -- 54) Using default applicationContext
13:02:03,116 INFO [com.sun.jersey.spi.spring.container.SpringComponentProviderFactory] (ServerService Thread Pool -- 54) Registering Spring bean, myService, of type com.example.myproject.services.MyService as a root resource class
- Here is an excerpt from web.xml to configure the provider:
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.example.myproject.providers</param-value>
</init-param>
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.