1 2 Previous Next 26 Replies Latest reply on Mar 13, 2014 5:13 PM by ejb3workshop Go to original post
      • 15. Re: NPE in org.jboss.weld.environment.servlet.Listener
        ejb3workshop

        Ok. Will give this a try.

        • 16. Re: NPE in org.jboss.weld.environment.servlet.Listener
          ejb3workshop

          I am now using the tomcat-maven plugin to deploy my application to the "/" context (see attached zip) however as soon as I click on the login link  I still get the exception.  I think it may have something to do with the context the application is deployed into. Looks like it doesn't like to be deployed as "/"

           

          Dec 04, 2013 9:57:51 AM org.apache.catalina.core.StandardContext fireRequestDestroyEvent
          SEVERE: Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.environment.servlet.Listener
          java.lang.NullPointerException
              at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71)
              at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:70)
              at org.jboss.weld.servlet.HttpContextLifecycle.requestDestroyed(HttpContextLifecycle.java:225)
              at org.jboss.weld.servlet.WeldInitialListener.requestDestroyed(WeldInitialListener.java:118)
              at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.requestDestroyed(ForwardingServletListener.java:38)
              at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6137)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

          • 17. Re: NPE in org.jboss.weld.environment.servlet.Listener
            mkouba

            Alexander, I have no idea. Actually I still can't reproduce your problem. I just took your project, executed "mvn clean package tomcat7:deploy", the WAR is successfully deployed and everything seems to work. Could you try a "fresh" Tomcat instance? What version of Tomcat do you use (I've tested 7.0.26 and 7.0.47)?

            • 18. Re: Re: NPE in org.jboss.weld.environment.servlet.Listener
              ejb3workshop

              Hi there,

               

              Here are the steps I followed to reproduce the problem using Java 7u45 on Linux.

               

              • Downloaded and extracted:apache-tomcat-7.0.47
              • Edited tomcat-users.xml
                <role rolename="manager-script"/>
                <role rolename="manager-gui"/>
                <role rolename="admin"/>
                <user password="tomcat" roles="manager-script,manager-gui,admin" username="tomcat"/>
              
              
              • Removed apache-tomcat-7.0.47/webapps/ROOT folder
              • Start tomcat
              • Deploy the application using:

              ~/Tools/apache-maven-3.1.1/bin/mvn clean package tomcat7:deploy

              alex@panda ~/Tools/apache-tomcat-7.0.47/logs $ ls -l
              total 20
              -rw-r--r-- 1 alex alex 3279 Dec  4 23:45 catalina.2013-12-04.log
              -rw-r--r-- 1 alex alex 3490 Dec  4 23:45 catalina.out
              -rw-r--r-- 1 alex alex    0 Dec  4 23:45 host-manager.2013-12-04.log
              -rw-r--r-- 1 alex alex 2197 Dec  4 23:45 localhost.2013-12-04.log
              -rw-r--r-- 1 alex alex 1331 Dec  4 23:46 localhost_access_log.2013-12-04.txt
              -rw-r--r-- 1 alex alex  410 Dec  4 23:45 manager.2013-12-04.log

              • In particular: localhost.2013-12-04.log

              Dec 04, 2013 11:45:21 PM org.apache.catalina.core.ApplicationContext log
              INFO: ContextListener: contextInitialized()
              Dec 04, 2013 11:45:21 PM org.apache.catalina.core.ApplicationContext log
              INFO: SessionListener: contextInitialized()
              Dec 04, 2013 11:45:21 PM org.apache.catalina.core.ApplicationContext log
              INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1c88c7e9')
              Dec 04, 2013 11:45:54 PM org.apache.catalina.core.StandardContext fireRequestDestroyEvent
              SEVERE: Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.environment.servlet.Listener
              java.lang.NullPointerException
                      at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71)
                      at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:70)
                      at org.jboss.weld.servlet.HttpContextLifecycle.requestDestroyed(HttpContextLifecycle.java:225)
                      at org.jboss.weld.servlet.WeldInitialListener.requestDestroyed(WeldInitialListener.java:118)
                      at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.requestDestroyed(ForwardingServletListener.java:38)
                      at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6137)
                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
                      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
                      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
                      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
                      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                      at java.lang.Thread.run(Thread.java:744)

              • 19. Re: Re: NPE in org.jboss.weld.environment.servlet.Listener
                mkouba

                I see. Finally I've been able to get the same NPE. It seems Weld is not able to deactive the request context. I will try to get more info.

                • 20. Re: NPE in org.jboss.weld.environment.servlet.Listener
                  mkouba

                  Alexander, it seems org.apache.catalina.authenticator.FormAuthenticator fires some nested requestInitialized/requestDestroyed events and it breaks context termination. I sent a question to the Tomcat dev mailing list - see http://mail-archives.apache.org/mod_mbox/tomcat-dev/201312.mbox/%3C52A1B37D.4010308%40redhat.com%3E for more info.

                  • 21. Re: NPE in org.jboss.weld.environment.servlet.Listener
                    ejb3workshop

                    Any news on this. It still happens using weld 2.1.2.Final.

                    • 22. Re: NPE in org.jboss.weld.environment.servlet.Listener
                      mkouba

                      I believe this is a Tomcat bug or at least uncovered part of the Servlet spec. Unfortunately I haven't got enough time to verify this properly and eventually provide a patch.

                      • 23. Re: Re: NPE in org.jboss.weld.environment.servlet.Listener
                        chrisjr

                        As requested in your comment on WELD-1020:

                         

                        I am also seeing this NPE in WELD-2.1.1.Final with Tomcat 7.0.23:

                         

                        2014-02-04 16:51:01,694 [http-apr-8080-exec-4] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/badweld]- Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.environment.servlet.Listener

                        java.lang.NullPointerException

                            at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71)

                            at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:70)

                            at org.jboss.weld.servlet.HttpContextLifecycle.requestDestroyed(HttpContextLifecycle.java:225)

                            at org.jboss.weld.servlet.WeldInitialListener.requestDestroyed(WeldInitialListener.java:118)

                            at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.requestDestroyed(ForwardingServletListener.java:38)

                            at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:5973)

                            at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:283)

                            at org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch(AbstractHttp11Processor.java:1515)

                            at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:523)

                            at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1817)

                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                            at java.lang.Thread.run(Thread.java:744)

                         

                        I managed to reproduce this using the same MyAsyncHandler asynchronous servlet class in WELD-1020, and have attached the servlet, web.xml and pom.xml files.

                        (Also attached the entire Maven project as a ZIP...)

                         

                        To reproduce: just invoke the asynchronous servlet:
                        http://localhost:8080/badweld/weldasync

                        • 24. Re: Re: NPE in org.jboss.weld.environment.servlet.Listener
                          jharting

                          WELD-1020 is a different problem. I filed WELD-1598 to track this one.

                          • 25. Re: NPE in org.jboss.weld.environment.servlet.Listener
                            zephnodnol

                            Hi Jozef,

                              We're also suffering from this problem. Are Tomcat looking at this problem at all? I looked at their Bugzilla and couldn't find anything. For the moment we've just moved everything back to synchronous Servlet calls and the errors seem to have gone away.

                             

                            Thanks,
                            Iain

                            • 26. Re: NPE in org.jboss.weld.environment.servlet.Listener
                              ejb3workshop

                              Hi all,

                               

                              I just tested my application on Tomcat 8.0.3 and the problem is still present. Other than the exception being logged I haven't seen any issues, but there could be problems caused by this which I haven't found yet.

                               

                              Martin, did you get any reply on the tomcat mailing list ?

                               

                              Thanks

                              1 2 Previous Next