Categories
Java

Guice: java.lang.IllegalStateException: No SessionHandler or SessionManager

One reason for this error would be that you should inject the session object directly, not via constructor:

So instead of:

@Singleton
public class Foo {

@Inject public Foo(HttpServletSession s) {
this.session = s  }
}

do this:

@Singleton
public class Foo{

@Inject Provider<HttpServletSession> session;

}

And it should work much better 🙂

1 reply on “Guice: java.lang.IllegalStateException: No SessionHandler or SessionManager”

Comments are closed.