Jersey container scans by default in the below location with respect to our application(s):
INFO: Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
Solution 1: Limit the jersey servlet container to specific to your folders (pack,pack2). Rest of the folder it ignores
<servlet>
<servlet-name>Jersey Restful Services</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.test.pack,com.test.pack2</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Solution 2: Disable auto scan the rest services
<!-- Auto scan REST service -->
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.resources</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>false</param-value>
</context-param>
blow are the other option we can choose based on need.
Option Name | Default Value | Description |
---|---|---|
resteasy.servlet.mapping.prefix | no default | If the url-pattern for the Resteasy servlet-mapping is not /* |
resteasy.scan | false | Automatically scan WEB-INF/lib jars and WEB-INF/classes directory for both @Provider and JAX-RS resource classes (@Path, @GET, @POST etc..) and register them |
resteasy.scan.providers | false | Scan for @Provider classes and register them |
resteasy.scan.resources | false | Scan for JAX-RS resource classes |
resteasy.providers | no default | A comma delimited list of fully qualified @Provider class names you want to register |
resteasy.use.builtin.providers | true | Whether or not to register default, built-in @Provider classes. (Only available in 1.0-beta-5 and later) |
resteasy.resources | no default | A comma delimited list of fully qualified JAX-RS resource class names you want to register |
resteasy.jndi.resources | no default | A comma delimited list of JNDI names which reference objects you want to register as JAX-RS resources |
javax.ws.rs.Application | no default | Fully qualified name of Application class to bootstrap in a spec portable way |
resteasy.media.type.mappings | no default | Replaces the need for an Accept header by mapping file name extensions (like .xml or .txt) to a media type. Used when the client is unable to use a Accept header to choose a representation (i.e. a browser). See JAX-RS Content Negotiation chapter for more details. |
resteasy.language.mappings | no default | Replaces the need for an Accept-Language header by mapping file name extensions (like .en or .fr) to a language. Used when the client is unable to use a Accept-Language header to choose a language (i.e. a browser). See JAX-RS Content Negotiation chapter for more details |
I have recently used WebLogic Server Version: 12.2.1.4.0 to deploy my war and am unable to load the js css image files from Resource folder. it returns 404 error. When i looked at deployments REST Services [ /resources/* ] (automatically registered) JAX-RS/Jersey#1 is displayed. 404 causing due to this? please give your thought.
ReplyDelete