Hello Ed,
please read chapter "Deploying a RESTful web service" in Jersey user
guide [1].
Init param "com.sun.jersey.config.property.packages" should contain
package name(s) in which your resource classes (and providers) are located.
Problem with your resource method is its parameter "InputStream data".
When you remove it, it should work fine. Take a look at helloworld
sample [2].
Passing parameters into your resource class method is described at [3].
Regards,
Pavel
[1]
https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e194
[2]
http://download.java.net/maven/2/com/sun/jersey/samples/helloworld/1.1.5.1/helloworld-1.1.5.1-project.zip
[3]
https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html#d4e226
nakoned wrote:
> Hi,
> I am having an issue deploying very simple Jersey app. I get the following
> exception:
> A HTTP GET method, public java.lang.String
> jersey.test.JerseyTestApp.test(java.io.InputStream), should not consume any
> entity
>
> I browsed through the forum and noticed that I need to set a provider. So I
> set the following in my 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>com.sun.jersey.config.property.packages</param-name>
> <param-value>jersey.test.JerseyTestApp</param-value>
> </init-param>
> </servlet>
>
> where jersey.test.JerseyTestApp is the name of my class annotated with
> @Provider
>
> When I do it however I get the following:
> SEVERE: The ResourceConfig instance does not contain any root resource
> classes.
>
> I am confused what should <init-param> cointain so that I do not get an
> error. Here is my simple class just in case:
> @Path("test")
> @Provider
> public class JerseyTestApp {
>
> @GET
> @Produces("text/plain")
> public String test(InputStream data) {
> String username = "Bla";
> return username;
> }
> }
>
> Thanks,
> Ed
>
>
>