1 2 3 Previous Next 36 Replies Latest reply on Feb 23, 2011 9:41 AM by slominskir Go to original post
      • 15. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
        marcosaps
        I've enabled the FORM authentication method in my application again (in the last posts I was with it disabled to make matters simple). Now I'm getting this error when I call the web application:

        2010-04-20 08:15:41,921 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/solicitacoes].[Faces Servlet]] (http-127.0.0.1-8080-1) 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:758)
             at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:139)
             at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:99)
             at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
             at org.jboss.weld.servlet.HttpSessionManager_$$_javassist_22.setSession(HttpSessionManager_$$_javassist_22.java)
             at org.jboss.weld.jsf.WeldPhaseListener.initiateSessionAndConversation(WeldPhaseListener.java:167)
             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.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:336)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
             at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734)
             at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541)
             at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479)
             at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407)
             at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:318)
             at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:243)
             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:559)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:872)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
             at java.lang.Thread.run(Thread.java:619)

        2010-04-20 08:15:41,937 WARN  [org.apache.catalina.authenticator.FormAuthenticator] (http-127.0.0.1-8080-1) Unexpected error forwarding to login page: javax.servlet.ServletException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:325)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:336)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
             at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734)
             at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541)
             at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479)
             at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407)
             at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:318)
             at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:243)
             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:559)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:872)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
             at java.lang.Thread.run(Thread.java:619)
        Caused by: 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:758)
             at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.getProxiedInstance(ClientProxyMethodHandler.java:139)
             at org.jboss.weld.bean.proxy.ClientProxyMethodHandler.invoke(ClientProxyMethodHandler.java:99)
             at org.jboss.weld.util.CleanableMethodHandler.invoke(CleanableMethodHandler.java:43)
             at org.jboss.weld.servlet.HttpSessionManager_$$_javassist_22.setSession(HttpSessionManager_$$_javassist_22.java)
             at org.jboss.weld.jsf.WeldPhaseListener.initiateSessionAndConversation(WeldPhaseListener.java:167)
             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)
             ... 21 more

        Again, this is my web.xml with security enabled:

        <?xml version="1.0" encoding="UTF-8"?>
        <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
             <display-name>Solicitações</display-name>

             <!-- ========== JSF ========== -->

             <servlet>
                  <servlet-name>Faces Servlet</servlet-name>
                  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                  <load-on-startup>1</load-on-startup>
             </servlet>

             <servlet-mapping>
                  <servlet-name>Faces Servlet</servlet-name>
                  <url-pattern>*.xhtml</url-pattern>
             </servlet-mapping>

             <context-param>
                  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                  <param-value>client</param-value>
             </context-param>

             <!-- <context-param>
                  <param-name>javax.faces.PROJECT_STAGE</param-name>
                  <param-value>Development</param-value>
             </context-param> -->

             <!-- ========== Segurança ========== -->

             <security-constraint>
                  <web-resource-collection>
                       <web-resource-name>restrito</web-resource-name>
                       <url-pattern>/*</url-pattern>
                  </web-resource-collection>
                  <auth-constraint>
                       <role-name>ADMINISTRADOR_GERAL</role-name>
                       <role-name>USUARIO</role-name>
                  </auth-constraint>
                  <user-data-constraint>
                       <transport-guarantee>NONE</transport-guarantee>
                  </user-data-constraint>
             </security-constraint>

             <security-constraint>
                  <web-resource-collection>
                       <web-resource-name>permitido</web-resource-name>
                       <url-pattern>/modelos/*</url-pattern>
                       <url-pattern>/resources/*</url-pattern>
                  </web-resource-collection>
                  <user-data-constraint>
                       <transport-guarantee>NONE</transport-guarantee>
                  </user-data-constraint>
             </security-constraint>

             <login-config>
                  <auth-method>FORM</auth-method>
                  <form-login-config>
                       <form-login-page>/login.xhtml</form-login-page>
                       <form-error-page>/errologin.xhtml</form-error-page>
                  </form-login-config>
             </login-config>

             <security-role>
                  <role-name>ADMINISTRADOR_GERAL</role-name>
             </security-role>
             <security-role>
                  <role-name>USUARIO</role-name>
             </security-role>
             <security-role>
                  <role-name>NAO_AUTORIZADO</role-name>
             </security-role>

             <!-- ========== Página inicial ========== -->

             <welcome-file-list>
                  <welcome-file>novasolicitacao.xhtml</welcome-file>
             </welcome-file-list>
        </web-app>

        And this is my simple login page (login.xhtml):

        <?xml version="1.0" encoding="ISO-8859-1" ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:ui="http://java.sun.com/jsf/facelets">
             <h:head>
                  <title>Solicitações - Universidade Regional do Cariri - URCA</title>
             </h:head>
             <h:body>
                  <form method="post" action="j_security_check">
                       <h5>Informe o seu número de matrícula e senha para acessar o sistema.</h5>
                       <div class="centralizado">
                            <table>
                                 <tr>
                                      <td>Matrícula:</td>
                                      <td><input type="text" value="90000005" name="j_username" id="matricula" class="campo" maxlength="8" /></td>
                                 </tr>
                                 <tr>
                                      <td>Senha:</td>
                                      <td><input type="password" value="1vgd4m" name="j_password" id="senha" class="campo" /></td>
                                 </tr>
                                 <tr>
                                      <td id="colunaBotao" colspan="2"><input type="submit" class="botao" value="Entrar" /></td>
                                 </tr>
                            </table>
                       </div>
                  </form>
             </h:body>
        </html>

        I have tried many changes in the login page in the hope that there was something wrong with it, but none worked. I think that this could possible be the last strange error to be solved.

        Thank you.

        Marcos
        • 16. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
          marcosaps

          Since last week I've devoted my entire work to get started with Jave EE 6 (CDI, JSF2, JPA2, EJB3.1), but now I'm really stuck with this last problem. I'm deeply sorry for my inconvenience,
          but I don't know where else to look for help. If I remove FORM based authentication the application works, but if I enabled it, as you saw in the last post with the full stack trace, I get this error:


          Unexpected error forwarding to login page: javax.servlet.ServletException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped


          Maybe I'm missing something or doing something wrong. I just would like that you, Weld architects and users, pointed out what it could be. If some of you is already using Weld with FORM based
          authentication I would like to have your help. I think that the solution of my issue could be helpful in some way to the community, if someone else has the same problem.


          Thank you in advance.


          Marcos

          • 18. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
            marcosaps

            Pete Muir wrote on Apr 20, 2010 19:12:


            Known issue - https://jira.jboss.org/jira/browse/WELDINT-43


            Hi, Pete. Thanks for your interest. But the error in my case happens when the container tries to forward to the login page, not the login error page. I don't even have the change to go to the login error page. What would be the solution in this case?


            Marcos

            • 19. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
              pmuir

              Marcos Antonio wrote on Apr 20, 2010 19:27:



              Pete Muir wrote on Apr 20, 2010 19:12:


              Known issue - https://jira.jboss.org/jira/browse/WELDINT-43


              But the error in my case happens when the container tries to forward to the login page, not the login error page. I don't even have the change to go to the login error page.


              I believe it's the same underlying problem.


              Best is probably to file a WELDINT issue, attaching a really simple example to allow us to reproduce easily. You should use a related issue link to connect it to WELDINT-43.


              I hope Marius can spend some time on this one soon.

              • 20. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                marcosaps

                Pete Muir wrote on Apr 21, 2010 11:27:



                Marcos Antonio wrote on Apr 20, 2010 19:27:



                Pete Muir wrote on Apr 20, 2010 19:12:


                Known issue - https://jira.jboss.org/jira/browse/WELDINT-43


                But the error in my case happens when the container tries to forward to the login page, not the login error page. I don't even have the change to go to the login error page.


                I believe it's the same underlying problem.

                Best is probably to file a WELDINT issue, attaching a really simple example to allow us to reproduce easily. You should use a related issue link to connect it to WELDINT-43.

                I hope Marius can spend some time on this one soon.


                Sorry for the delay. Yesterday I was off, holiday here in Brazil.


                Done:


                https://jira.jboss.org/jira/browse/WELD-499


                Marcos

                • 21. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                  marcosaps

                  I don't know exactly how JIRA works, but in case you haven't been notified, last Friday I added a new comment to WELD-499. Reading the comment you'll see the confirmation that the problem is in Weld itself.


                  Marcos

                  • 22. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                    pmuir

                    Thanks, we will take a look :-)

                    • 23. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                      theo

                      Hello Marco,


                      have you found a solution to this issue? I have the same problem and the bug is still unresolved in JIRA.


                      Regards,
                      Theo

                      • 24. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                        marcosaps

                        Unfortunately not, Theo. I'm still with the same bug. By the way, a huge bug.


                        Marcos

                        • 25. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                          user.java

                          I have JBoss 6 and it works for me.


                          Donot put the javax.inject.jar file in your war.Jboss lib already has this jar.

                          • 26. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                            marcosaps

                            User Java wrote on Jul 06, 2010 16:45:


                            I have JBoss 6 and it works for me.

                            Donot put the javax.inject.jar file in your war.Jboss lib already has this jar.


                            Well, it highly depends on the kind of configuration and projects your application has. Maybe if your application was a little more similar to mine, you would get the same error. My application is a EAR with a WAR, EJB, and EJB client projects.


                            Marcos

                            • 27. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                              marcosaps
                              As I said before, the main reason to me to migrate early to Java EE 6 is to use CDI. The capability to integrate everything in the Java EE world in a loosely coupled and elegant way is something that can't be overlooked. But since from the early beginning when I started playing with CDI, I've found my desire to use it threatened by the error that you all see in this discussion.

                              I've waited anxiously for JBoss 6 M4 to come out in the hope that this error is gone finally. So I migrated my project to JBoss 6 M4 and found, to my surprise, that nothing has changed. I'm still getting the same error. JIRA has proved to be useless to me. I've reported this there and there's no activity there.

                              Please note that, in my point of view, this is a HUGE bug, unless I'm the only person in the planet that is using JBoss 6 + an web application that has FORM based authentication + CDI that have this error. So CDI is not working with an web application that has FORM based authentication enabled. If I use the JSF 2.0 annotations in my managed beans the application works.

                              I need help with this issue. I'm decided to send a zip file with my (simple) project to some of you who would want to test the application and see if you find a solution. I'll also send the build instructions. It is very simple. This is my e-mail:

                              marcos_antonio_ps@hotmail.com

                              So, if you send me a request I will reply to it with the project attached and you can have a change to see what I'm talking about. I can't wait on JIRA. If you also have some other idea how to fix the problem, please tell me. I think this bug can't be neglected.

                              Thank you.

                              Marcos
                              • 28. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                                marcosaps
                                <blockquote>
                                _User Java wrote on Jul 06, 2010 16:45:_<br/>

                                I have JBoss 6 and it works for me.

                                Donot put the javax.inject.jar file in your war.Jboss lib already has this jar.
                                </blockquote>

                                Hello, User Java!

                                I didn't put the javax.inject.jar file in my war. As you said you have an application that is working with FORM based authentication and Weld, I would like to ask you some questions:

                                1. Do your application uses EJBs?
                                2. Could you please show me the contents of your web.xml file, specially your configuration
                                   of the faces servlet, the security section and your welcome file list?

                                This is the contents of my web.xml file:

                                <?xml version="1.0" encoding="UTF-8"?>
                                <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                                     version="2.5">
                                     <display-name>Solicitações</display-name>

                                     <!-- ========== JSF ========== -->

                                     <servlet>
                                          <servlet-name>Faces Servlet</servlet-name>
                                          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                                          <load-on-startup>1</load-on-startup>
                                     </servlet>

                                     <servlet-mapping>
                                          <servlet-name>Faces Servlet</servlet-name>
                                          <url-pattern>*.xhtml</url-pattern>
                                     </servlet-mapping>

                                     <context-param>
                                          <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                                          <param-value>client</param-value>
                                     </context-param>

                                     <!-- ========== Security ========== -->

                                     <security-constraint>
                                          <web-resource-collection>
                                               <web-resource-name>restrito</web-resource-name>
                                               <url-pattern>/*</url-pattern>
                                          </web-resource-collection>
                                          <auth-constraint>
                                               <role-name>ADMINISTRADOR_GERAL</role-name>
                                               <role-name>USUARIO</role-name>
                                          </auth-constraint>
                                     </security-constraint>

                                     <security-constraint>
                                          <web-resource-collection>
                                               <web-resource-name>permitido</web-resource-name>
                                               <url-pattern>/modelos/*</url-pattern>
                                               <url-pattern>/resources/*</url-pattern>
                                               <url-pattern>/esquecimentosenha.xhtml</url-pattern>
                                          </web-resource-collection>
                                     </security-constraint>

                                     <login-config>
                                          <auth-method>FORM</auth-method>
                                          <form-login-config>
                                               <form-login-page>/login.xhtml</form-login-page>
                                               <form-error-page>/errologin.xhtml</form-error-page>
                                          </form-login-config>
                                     </login-config>

                                     <security-role>
                                          <role-name>ADMINISTRADOR_GERAL</role-name>
                                     </security-role>
                                     <security-role>
                                          <role-name>USUARIO</role-name>
                                     </security-role>
                                     <security-role>
                                          <role-name>NAO_AUTORIZADO</role-name>
                                     </security-role>

                                     <!-- ========== Welcome page ========== -->

                                     <welcome-file-list>
                                          <welcome-file>novasolicitacao.xhtml</welcome-file>
                                     </welcome-file-list>
                                     
                                     <!-- ========== Error pages ========== -->
                                     
                                     <!-- <error-page>
                                          <error-code>500</error-code>
                                          <location>/erro.xhtml</location>
                                     </error-page> --> 
                                     <error-page>
                                          <error-code>403</error-code>
                                          <location>/naoautorizado.xhtml</location>
                                     </error-page>
                                </web-app>

                                I realized that for the error to pop up I don't even need to use CDI annotations in my application. I just need to place a beans.xml file in it. If I remove the beans.xml file the login page shows correctly.

                                Theodor Richard, have you found a solution to this problem?

                                By the way, do any of you, besides Theodor Richard, is having this same problem? If not, do you have a hint about what could be wrong with my application to be causing this error?

                                Marcos
                                • 29. Re: JBoss 6M2: WELD-000702 Unable to find BeanManager for org.apache.catalina.core.ApplicationContextFacade@b8c4f5
                                  scotchy

                                  I have the exact same problem.  Very simple JSF2.0, WELD, Tomcat 7 using FORM Authentication and get the same error org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped.  Im at the point of dumping CDI as I am not sure its useful if FORM Authentication doesn't work.  This seems to me to be a big hold in throwing an exception when you are trying to forward to another page on a separate session that isn't associated with the original session when the request was made.  Tomcat will restore the original session after the login succeeds.