3 Replies Latest reply on Feb 13, 2011 2:23 PM by Miroslav Liska

    ServerAuthModule cannot forward to JSF page - no active context

    Cory Prowse Newbie

      When implementing my own ServerAuthModule in Glassfish 3.0.1 I cannot forward or redirect to a JSF page.


      I am essentially doing the following:


        final RequestDispatcher disp = request.getRequestDispatcher("/login.xhtml");
        disp.forward(request, response);



      Is there a way to ensure that the RequestScope is active in WELD?
      Perhaps it is related to this bug: https://glassfish.dev.java.net/issues/show_bug.cgi?id=11504


      Full stack trace is:


      [#|2010-07-14T10:21:10.803+1000|WARNING|glassfish3.0.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=27;_ThreadName=http-thread-pool-18081-(1);|ApplicationDispatcher[/projectx] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
      org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
           at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:679)
           at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:138)
           at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:100)
           at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
           at org.jboss.weld.servlet.HttpSessionManager_$$_javassist_20.setSession(HttpSessionManager_$$_javassist_20.java)
           at org.jboss.weld.jsf.WeldPhaseListener.initiateSessionAndConversation(WeldPhaseListener.java:168)
           at org.jboss.weld.jsf.WeldPhaseListener.beforeRestoreView(WeldPhaseListener.java:118)
           at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:87)
           at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
           at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
           at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:822)
           at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
           at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:517)
           at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:488)
           at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:379)
           at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:336)
           at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:314)
           at au.projectx.openid.sam.OpenIdSam.redirectToPage(OpenIdSam.java:125)
           at au.projectx.openid.sam.OpenIdSam.validateRequest(OpenIdSam.java:90)
           at com.sun.enterprise.security.jmac.config.GFServerConfigProvider$GFServerAuthContext.validateRequest(GFServerConfigProvider.java:1167)
           at com.sun.web.security.RealmAdapter.validate(RealmAdapter.java:1303)
           at com.sun.web.security.RealmAdapter.invokeAuthenticateDelegate(RealmAdapter.java:1184)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:619)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:615)
           at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
           at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
           at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:239)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
           at java.lang.Thread.run(Thread.java:637)
      |#]