How do I get a JAX-RS application running on WebSphere 8.5
ear, jax-rs, war, websphere
Solution
WAS8.5 supports v2.4 and v3 servlets. The reason removing your web.xml contents (and using 3.0 code) worked for you is because you had a mistake in the param-name tag of your web.xml. v2.4 servlet works fine in WAS8.5 when you use the correct param-name.
This is incorrect.
<param-name>jaxrs.ws.rs.Application</param-name>
This is correct:
<param-name>javax.ws.rs.Application</param-name>
Details: http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.nd.multiplatform.doc/ae/twbs_jaxrs_configwebxml.html
Problem
So I am tring to get a JAX-RS application working on my WebSphere 8.5 instance. I created the following interface... ``` @Path("service") public class RestService { @GET @Produces("text/plain") public int getCount(){ return 1; } } ``` And This is my Application... ``` public class RESTConfig extends Application{ @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new Hashset<?>(); classes.add(RestService.class); return classes; } } ``` And then this is my web.xml... ``` <servlet> <servlet-name>Rest Servlet</servlet-name> <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class> <init-param> <param-name>jaxrs.ws.rs.Application</param-name> <param-value>com.company.rest.RESTConfig</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> .... <servlet-mapping> <servlet-name>Rest Servlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> ``` Then I have an EAR configured with the WAR as a module. But when I start everything and try going to http://localhost:[port]/war/rest/app/service I see.. [TIME] 00000115 RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (404 - Not Found) with message 'null' while processing GET request sent to http://localhost:[port]/war/rest/service Please Help!