Question

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?

Was it helpful?

Solution

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()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top