views:

27

answers:

1

I trying to expose some groovy service with jersey and girzzly. but i got a wierd error when i'm launching my servlet container. Here is the snippet which lauch it:

ServletAdapter adapter = new ServletAdapter();
Injector injector = Guice.createInjector(new GmediaModule());

GuiceContainer container = new GuiceContainer(injector);
adapter.setServletInstance(container);
adapter.setContextPath("gmedia")

adapter.addInitParameter("com.sun.jersey.config.property.packages",
                   "gmedia.api.music.resources");

threadSelector = GrizzlyServerFactory.create(BASE_URI, adapter);

Here is the error:

java.lang.NoSuchMethodError: com.sun.grizzly.tcp.http11.GrizzlyAdapter.setResourcesContextPath(Ljava/lang/String;)V

The error occurs at the grizzlyServeletFactory.create. I'm wordering why this error occurs since this metod exist on this oject?

A: 

sorry i was an idiot. Here is what i'm using now GrizzlyWebServer ws = new GrizzlyWebServer(9999);

ServletAdapter adapter = new ServletAdapter();
Injector injector = Guice.createInjector(new GmediaModule());

GuiceContainer container = new GuiceContainer(injector);
adapter.setServletInstance(container);


adapter.addInitParameter("com.sun.jersey.config.property.packages",
                   "gmedia.api.music.resources");

ws.addGrizzlyAdapter(adapter);
ws.start()
BenZen
Why does this solve your problem? I have a similar error using JerseyTest
IttayD
OOps sorry, it miss somthing. There variable ws is a GrizzlyWebServer. ws = new GrizzlyWebServer(SERVER_PORT);Previously I wasn't using this type at all. I think this is where my error belong.
BenZen