I am trying to create a simple webservice using jersey rest webservices. So I created a simple class that i called main :
@Path("/main")
public class main {
@GET
@Path (value="Stringtest")
@Produces(MediaType.APPLICATION_JSON)
public String Stringtest()
{
System.out.println("************");
return ("string");
}
}
And then I chaged web.xml ( my package's name is "test")
<?xml version="1.0" encoding="ASCII"?>
<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" version="3.0">
<display-name>rest</display-name>
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>test</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
it seems that there is something wrong in the web.xml because i get this error
Infos: Scanning for root resource and provider classes in the packages:
test
AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
Infos: Root resource classes found:
class test.main
com.sun.jersey.api.core.ScanningResourceConfig init
Infos: No provider classes found.
Are there any suggestions to this issue? Please help!