i've already tried a lot suggestions, but none seemed to work for me. When deploying my jersey application on tomcat, no errors occur. But when accessing any of the specified paths it gives me 404 aka resource is not available. I'll give you relevant parts of my files:
web.xml
<web-app>
<servlet>
<servlet-name>o2r</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>
jersey.config.server.provider.packages
</param-name>
<param-value>com.mypackage.project.MyClass</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>o2r</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
MyClass.java
package com.mypackage.project;
... //imports etc
@Path("control")
public class MyClass
{
@GET
@Path("{param}")
public Response getMsg(@PathParam("param") String msg)
//this part is from some mykong tutorial
{
String output = "Jersey say : " + msg;
return Response.status(200).entity(output).build();
}
}
pom.xml
...
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.16</version>
</dependency>
...
When trying to access
http://localhost:8080/MyClass/control/lala
(which should return "Jersey say : lala") it just gives me 404. Note: MyClass is the correct name of my .WAR-file.