views:

36

answers:

1

This is my SLSB:

@Stateless(name = "FinderEJB")
@Path("/")
public class Finder implements FinderLocal {
  @Path("/simple")
  @GET
  public String simple() {
    return "works";
  }
}

The interface is:

@Local
public interface FinderLocal {
  public String simple();
}

This is what I'm getting in Glassfish server log when I'm trying to open the url /simple:

java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:208)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:115)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:75)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:115)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:67)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:775)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:740)
[...]

What is it about? I managed to find a topic about it at nabble.com, but it has no solution..

A: 

I had a similar problem; it turned out it was a configuration error in web.xml.

Be sure to use something like:

<servlet>
<servlet-name>Jersey Servlet</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>my.company.product.rs</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

Hope it helped

Frederick
@Frederick Of course my `web.xml` is configured properly. Without SLSB annotations the class works fine and is exposed in JAX-RS.
Vincenzo