I am running JBOSS 6.4 EAP in eclipse oxygen.
I have a simple and working webservice that just returns is alive.
When I configure the url-pattern as " /* " it is executed as expected. When I put a more substantial pattern "/rws/*" in the url-pattern I get 404
My URL is localhost:8080/mesh/rws/menu/isAlive
failing web.xml There is no corresponding servlet block for this servlet
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rws/*</url-pattern>
</servlet-mapping>
Servlet Class
@Path("/rws/menu")
public class MenuService
{
@GET
@Path("/isAlive")
public Response isAlive()
{
return Response.ok("I am alive").build();
}
}
Error from Server
JBWEB000065: HTTP Status 404 - RESTEASY001185: Could not find resource for relative : /menu/isAlive of full path: http://localhost:8080/mesh/rws/menu/isAlive
Context param I have tried adding the context param to web.xml as suggested in various places on line, but it seems already set and I am not sure how to over ride.
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rws</param-value>
</context-param >
yields error:
ERROR [org.apache.catalina.core] (ServerService Thread Pool -- 64) JBWEB001097: Error starting context /mesh: java.lang.IllegalArgumentException: JBWEB000280: Duplicate context initialization parameter resteasy.servlet.mapping.prefix
When you have /rws/*
in the url-pattern, you're not supposed to put /rws
in the @Path
also. If you do this, then the url would be /rws/rws
. The url-pattern is the prefix for the entire application. So just remove the /rws
from the @Path
.