the answer is in the error message ...apply com.google.inject.servlet.GuiceFilter as a servlet filter...
you need that filter so guice can define web-related scopes -igor On Thu, May 13, 2010 at 8:00 AM, Alexander Monakhov <domin...@gmail.com> wrote: > Hi, guys. > > I'm trying to use wicket-guice extension in my wicket application. > My application instantiates some services in my session implementation and > passes some parameters to it when user is authenticated. > I'm trying to inject these services using Guice. > But they're not injected in my session implementation, because guice > extension makes injection only to wicket components. > In this case, I'm trying to do this explicitly via my base page: > > Injector injector = getApplication().getMetaData( > GuiceInjectorHolder.INJECTOR_KEY ).getInjector(); > injector.injectMembers( getSession() ); > > This time, I catch this: > > com.google.inject.OutOfScopeException: Cannot access scoped object. Either > we are not currently inside an HTTP Servlet request, or you may have > forgotten to apply com.google.inject.servlet.GuiceFilter as a servlet filter > for this request. > > If I set injected services that are injected to base page directly to > session like that: > > MySession session = (MySession) getSession(); > session.setMyService( myService ); > > When I catch the same OutOfScopeException when I'm trying to invoke any > method of this service from my session implementation. > > Could you give me any advise? How could I use injected services in session > implementation? > > Best regards, Alexander. > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org