Sometimes troubleshooting java webservices is frustrating so it is helpful to follow some simple steps to find the error.
Is your firewall on? Check that it is off or not blocking the port your webserver running on. Most of the time it is port 8080. It is in the url localhost:
8080
/mywebservice/urlCheck the root application page supplied by your server to make sure the server is running at all. On Tomcat that usually localhost:8080/manager/html
Check the logs of your application container for a stacktrace on startup to make sure your deployment is not in error.
Try to deploy a minimum possible webservice such as "Hello World" jax-rs to make sure you have the correct libraries and other configurations available.
If you pass all of those and still no webservice your jax-rs annotations are probably incorrect in some manner. You can enable Request Matching in your web.xml by adding to the configuration.
<web-app> <servlet> <servlet-name>Jersey REST Service for value codes</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> ... <init-param> <param-name>com.sun.jersey.config.feature.Trace</param-name> <param-value>true</param-value> </init-param> </servlet> ... </web-app>
You'll see url traces in your log
{X-Jersey-Trace-008=[mapped exception to response: javax.ws.rs.WebApplicationException@56f9659d -> 415 (Unsupported Media Type)],
X-Jersey-Trace-002=[accept right hand path java.util.regex.Matcher[pattern=/myResource/([-0-9a-zA-Z_]+)(/.*)? region=0,17 lastmatch=/myResource/23/mySubresources]: "/myResource/23/mySubresources" -> "/myResource/23" : "/mySubresources"],
hint: probably not a good idea to leave this on in production