Jersey application can't scan JAX-RS resources when deploying it to EAP 6
Issue
- Have configured Jersey to scan JAX-RS resources in a specific package by adding the following init parameter to Jersey Servlet declaration in web.xml:
<servlet>
<servlet-name>JerseyWebApplication</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.example.resources</param-value>
</init-param>
</servlet>
When I deploy it to EAP 6 I have the following error:
JBWEB000289: Servlet ServletAdaptor threw load() exception: com.sun.jersey.core.spi.scanning.ScannerException: The URI scheme vfs of the URI vfs:/your/resource/class/url is not supported. Package scanning deployment is not supported for such URIs.
Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application
- Using
packagesto scan the resources classes are not having any effect. Resources aren't getting registered. My Application class looks like the following:
@ApplicationPath("resources")
public class MyApplication extends ResourceConfig {
public MyApplication() {
packages("com.example.rest;org.bar.rest");
}
}
If I register the resource manually using the register method it works.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- Jersey 2.7, 2.8, 2.9, 2.10, 2.11, 2.12
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.