guice injecting remote servlet. Error 404 not found

348 views
Skip to first unread message

Mark Diesta

unread,
Mar 21, 2012, 1:10:53 AM3/21/12
to google-we...@googlegroups.com
I would like to use the Guice in my remote servlet but encountered this annoying errors.

Before starting my project there is error already.

WARNING: Error starting handlers
java.lang.NoSuchMethodError: com.google.inject.Scopes.isSingleton(Lcom/google/inject/Binding;)Z
at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:103)
at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:82)
at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:102)
at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:172)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:191)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:146)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)


After starting the project.

404 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 NOT_FOUND</title>
</head>
<body>
<h2>HTTP ERROR: 404</h2>
<p>Problem accessing /mercado/login. Reason:
<pre>    NOT_FOUND</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>


Here is my code.

web.xml

<!-- Guice configuration -->
<listener>
<listener-class>ph.com.mercado.server.ioc.GuiceServletListener</listener-class>
</listener>
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>guiceFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


public class GuiceServiceModule extends AbstractModule {

@Override
protected void configure() {
bind(LoginServiceImpl.class).in(Singleton.class);


public class GuiceServletListener extends GuiceServletContextListener{

@Override
public Injector getInjector() {
return Guice.createInjector(new GuiceServletModule(), new GuiceServiceModule());
}

public class GuiceServletModule extends ServletModule  {

@Override
protected void configureServlets() {
serve("/mercado/login").with(LoginServiceImpl.class);

@RemoteServiceRelativePath("login")
public interface LoginService extends RemoteService {
public LoginInfo loginGoggle(String requestUri);


public class LoginServiceImpl extends RemoteServiceServlet implements
LoginService {

@Inject
private UserDao userDao;
@Override
public LoginInfo loginGoggle(String requestUri) {}

}



What seems to be the problem? Thank you.


Damien Irving

unread,
May 30, 2012, 10:44:27 AM5/30/12
to google-we...@googlegroups.com
I have this issue also, did you find a solution for it?

Ali Thabet

unread,
May 30, 2012, 3:45:27 PM5/30/12
to google-we...@googlegroups.com
did you have guice-snapshot.jar in your classpath?

Mark Diesta

unread,
May 31, 2012, 3:27:41 AM5/31/12
to google-we...@googlegroups.com
It was a jar issues. You should check if you have multiple guice jars in your build path. As much as possible use the guice included in the gin so there will be no conflict.

On Thu, May 31, 2012 at 3:45 AM, Ali Thabet <thabet...@gmail.com> wrote:
did you have guice-snapshot.jar in your classpath?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
May 31, 2012, 4:08:52 AM5/31/12
to google-we...@googlegroups.com


On Thursday, May 31, 2012 9:27:41 AM UTC+2, Mark Diesta wrote:
It was a jar issues. You should check if you have multiple guice jars in your build path. As much as possible use the guice included in the gin so there will be no conflict.

GIN works well with Guice 3 though, if you prefer stable versions.
FYI, GIN 1.5.0 on Maven depends on Guice 3.0-rc2 (which is forward-compatible with 3.0)
BTW, this is also advertized on the project home page https://code.google.com/p/google-gin/ (though a bit outdated, as it still talks about the "soon-to-be-released Guice 3.0", and should probably link to http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.gwt.inject%22%20AND%20a%3A%22gin%22 for Maven dependencies)
Reply all
Reply to author
Forward
0 new messages