I have developed several web services using Eclipse and Jersey and Tomcat 7 as a server.
When you start a project from Eclipse, everything works fine. However, when deploying the project WAR file directly to Tomcat (using its manager), I get a 404 error when calling the service.
My WEB-INF \ lib directory contains all jersey libs.
my web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>myApp</display-name> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>myApp REST Service</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.myapp.resources</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>myApp REST Service</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app>
I believe that I have something missing in the Tomat configuration, but I have no idea ...
Any idea?
Ahanks, Assaf
source share