13 Replies Latest reply on Oct 12, 2007 11:57 AM by Matthew Lieder

    Weird random "session was null" exceptions

    Matthew Lieder Apprentice

      I've recently started randomly seeing the following exception:

      java.lang.IllegalStateException: Could not start transaction
       at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:571)
       at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:307)
       at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
       at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:165)
       at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:336)
       at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
       at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
       at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:198)
       at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalStateException: session was null: #{ourDatabase}
       at org.jboss.seam.transaction.HibernateTransaction.initSession(HibernateTransaction.java:71)
       at org.jboss.seam.transaction.HibernateTransaction.begin(HibernateTransaction.java:79)
       at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:566)
       ... 32 more


      Anyone know what the cause might be? It doesn't seem to affect the functionality of anything...

        • 1. Re: Weird random
          Matthew Lieder Apprentice

          By not affecting the functionality, I mean that my database reads and writes all seem to work fine.

          • 3. Re: Weird random
            Matthew Lieder Apprentice

            Being a RichFaces integration problem makes sense, since that's about the time I started having this problem. I'll add my vote to it...

            • 4. Re: Weird random
              Matthew Lieder Apprentice

              Still occurring with Seam 2.0.0-CR2 and RichFaces 3.1.1-GA, though with a slightly different stack trace (see the bridge between ajax4jsf and seam):

              ERROR SeamPhaseListener - uncaught exception
              java.lang.IllegalStateException: Could not start transaction
               at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:571)
               at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:307)
               at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
               at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
               at org.ajax4jsf.resource.ResourceLifecycle.invokePhaseListener(ResourceLifecycle.java:201)
               at org.ajax4jsf.resource.ResourceLifecycle.processPhaseListeners(ResourceLifecycle.java:177)
               at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:147)
               at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:336)
               at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
               at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
               at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:198)
               at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
               at com.fl.nuevo.utils.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:42)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
               at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
               at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
               at java.lang.Thread.run(Thread.java:595)
              Caused by: java.lang.IllegalStateException: session was null: #{trackerDatabase}
               at org.jboss.seam.transaction.HibernateTransaction.initSession(HibernateTransaction.java:71)
               at org.jboss.seam.transaction.HibernateTransaction.begin(HibernateTransaction.java:79)
               at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:566)
               ... 34 more


              • 5. Re: Weird random
                Pete Muir Master

                Can you open a new JIRA issue please?

                • 7. Re: Weird random
                  Pete Muir Master

                  Could you post your components.xml?

                  • 8. Re: Weird random
                    Pete Muir Master

                    Even better if you can attach a simple testcase to reproduce to the jira issue that would be great!

                    • 9. Re: Weird random
                      Matthew Lieder Apprentice

                      Here's my components.xml:

                      <?xml version="1.0" encoding="UTF-8"?>
                      <components xmlns="http://jboss.com/products/seam/components"
                       xmlns:bpm="http://jboss.com/products/seam/bpm"
                       xmlns:core="http://jboss.com/products/seam/core"
                       xmlns:persistence="http://jboss.com/products/seam/persistence"
                       xmlns:security="http://jboss.com/products/seam/security"
                       xmlns:transaction="http://jboss.com/products/seam/transaction"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation=
                       "http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
                       http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd">
                      
                       <core:init debug="true"/>
                      
                       <core:manager conversation-timeout="120000"
                       concurrent-request-timeout="500"
                       conversation-id-parameter="cid"/>
                      
                      
                       <component name="hibernateSessionFactory" class="com.fl.nuevo.seam.SmartHibernateSessionFactory" />
                      
                       <persistence:managed-hibernate-session name="trackerDatabase"
                       session-factory="#{hibernateSessionFactory}"
                       auto-create="true"/>
                      
                       <transaction:hibernate-transaction session="#{trackerDatabase}"/>
                      
                      
                       <bpm:jbpm>
                       <bpm:pageflow-definitions>
                       <value>com/fl/nuevo/scheduler/process_scheduleCall.jpdl.xml</value>
                      
                       <value>com/fl/nuevo/scheduler/initialCall.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/rescheduleCall.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/rescheduleCallReason.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/devCall.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/subsDevCall.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/reassignRoles.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/updateContacts.jpdl.xml</value>
                       <value>com/fl/nuevo/scheduler/callDetails.jpdl.xml</value>
                       </bpm:pageflow-definitions>
                       </bpm:jbpm>
                      
                      
                       <component class="com.fl.nuevo.hibernate.helper.HelperFactory" name="hh" scope="STATELESS" />
                      
                       <component class="org.jboss.seam.international.TimeZoneSelector">
                       <property name="timeZoneId">America/Chicago</property>
                       </component>
                      
                      </components>


                      I'll try to put together a test app, though that might take a while.

                      • 10. Re: Weird random
                        Pete Muir Master

                        Thanks!

                        • 11. Re: Weird random
                          Matthew Lieder Apprentice

                          It's apparently so random, when I get the exception and then restart the server and perform the same steps the exception doesn't happen :/. A number of times I've also gone to pages and they loaded exception-free, but then a mere browser refresh causes the exception (only the first refresh, not additional). Very, very strange...

                          • 12. Re: Weird random
                            Pete Muir Master

                            I think it's related to http://jira.jboss.com/jira/browse/RF-1109 - which Wesley just provided us with an example of. I suggest you hang tight until we can get his example fixed and try that?

                            • 13. Re: Weird random
                              Matthew Lieder Apprentice

                              Ok, sounds good :)