Jersey REST Web Service, Tomcat, Eclipse and 404's
Jersey 2.0 does not recognize init-param with name com.sun.jersey.config.property.packages
(web.xml). Try to change it to jersey.config.server.provider.packages
as described in ServerProperties.PROVIDER_PACKAGES.
UPDATE (2020): try this link for current apidocs ServerProperties.PROVIDER_PACKAGES:
Thanks a lot.. i've been fighting for it as well.
This combination worked for me: Tomcat 7.0.55 Eclipse Luna Java 1.6 Jersey 1.7
web.xml:
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.trgr.cobalt.cmdb.jersey.resource;com.trgr.cobalt.cmdb.jersey.beans;com.trgr.cobalt.cmdb.elasticity</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
I would like to add one answer in this post.I was struggling with same problem for two days and couldn't find the solution. I tried all the possible solutions provided here but later on I realized that server was giving error of
org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
This link answers gives the solution if somebody is stuck like me.. org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException
Actually first answer given in this post suggest the solution which is for jersey 2.x bundle and if you are using jersey 1.x then it will keep on giving error.
Kindly refer to link given in answer for further reference