1 2 Previous Next 15 Replies Latest reply on Jun 2, 2009 5:37 PM by Stephane Epardaud

    EmptyStackException

    Bram Biesbrouck Newbie

      Hi all,


      I keep getting error messages like the one below. Could someone please explain to me what they mean, or how to fix their cause?



      java.util.EmptyStackException
              at java.util.Stack.peek(Stack.java:79)
              at java.util.Stack.pop(Stack.java:61)
              at org.jboss.seam.transaction.SeSynchronizations.afterTransactionRollback(SeSynchronizations.java:45)
              at org.jboss.seam.transaction.UTTransaction.rollback(UTTransaction.java:70)
              at org.jboss.seam.web.ExceptionFilter.rollbackTransactionIfNecessary(ExceptionFilter.java:159)
              at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:113)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              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:158)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              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:157)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
      at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Thread.java:595)


        • 1. Re: EmptyStackException
          Arbi Sookazian Master

          never seen that exception before.  does it happen randomly or is it easily reproducible?  if the latter, then add some brkpts in the debugger and determine what line of code is throwing that exception.


          are you using the Stack class in your code?


          http://java.sun.com/j2se/1.5.0/docs/api/java/util/Stack.html


          if it's not your code that's causing it, I would extract a fresh JBoss 4.2 (or 5.0) AS and then clean and deploy your Seam app...

          • 2. Re: EmptyStackException
            Bram Biesbrouck Newbie

            Hey Arbi,


            No, I'm not using the Stack class myself.
            The exception gets thrown pseudo-randomly. That is, it happens a few times an hour on my production server. But I've never succeeded in reproducing it on my dev machine.


            Pretty obscure and difficult to debug :-(

            • 3. Re: EmptyStackException
              Stuart Douglas Master

              Can you post all the info you have on your transaction setup? Are you in an ejb environment? If so do you have transaction:ejb-transaction registered in components.xml?

              • 4. Re: EmptyStackException
                Bram Biesbrouck Newbie

                The app runs in a standard Jboss 4.2.3 installation.
                Below is the contents of my components.xml file.


                I assume this is all standard stuff, nothing fancy.


                <core:init debug="true" jndi-pattern="@jndiPattern@"/>
                     
                   <core:manager concurrent-request-timeout="500" 
                                 conversation-timeout="120000" 
                                 conversation-id-parameter="cid"
                                 parent-conversation-id-parameter="pid"/>
                   
                   <core:resource-loader>
                          <core:bundle-names>
                               <value>huureenstudent_messages</value>
                               <value>messages</value>
                          </core:bundle-names>
                     </core:resource-loader>
                   
                   <persistence:managed-persistence-context name="entityManager"
                                                     auto-create="true"
                                      persistence-unit-jndi-name="java:/huureenstudentEntityManagerFactory"/>                          
                
                   <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="true"/>
                   <security:jpa-identity-store 
                       user-class="be.beligum.huureenstudent.entities.PrincipalImpl"
                       role-class="be.beligum.huureenstudent.entities.PrincipalRole"
                       />
                   
                   <security:jpa-token-store token-class="be.beligum.huureenstudent.entities.AutoLoginToken"/>
                   <security:remember-me mode="autoLogin"/>
                   
                   <event type="org.jboss.seam.security.notLoggedIn">
                      <action execute="#{redirect.captureCurrentView}"/>
                   </event>
                   <event type="org.jboss.seam.security.loginSuccessful">
                      <action execute="#{redirect.returnToCapturedView}"/>
                   </event>
                   
                   <mail:mail-session host="#{resourceManager.mailServerHostname}" port="#{resourceManager.mailServerPort}" />
                   
                   <web:multipart-filter create-temp-files="true" />
                   
                   <document:document-store use-extensions="true" />


                • 5. Re: EmptyStackException
                  Arbi Sookazian Master

                  transaction:ejb-transaction is not required apparently as seam-gen doesn't include it in the outputted components.xml (I don't have that metadata in mine either, no problems so far)...


                  here's the relevant comment on that tag from the ref docs:



                  In an EJB3 environment, we recommend the use of a special
                  built-in component for transaction management, that is fully aware of container transactions,
                  and can correctly process transaction success events registered with the Events component. If
                  you don't add this line to your components.xml file, Seam won't know when container-managed
                  transactions end:
                  • 6. Re: EmptyStackException
                    Arbi Sookazian Master

                    what logging level is that exception (e.g. ERROR, INFO, DEBUG)?

                    • 7. Re: EmptyStackException
                      Bram Biesbrouck Newbie

                      Hi Arbi,


                      Thanks for the quick reply. I'll look into it, but I can only assume something changed over time, because I've never had this exceptions thrown before.

                      • 8. Re: EmptyStackException
                        Bram Biesbrouck Newbie

                        It's an ERROR. I'll try raising the level on my production server to see if I can get more info about it.

                        • 9. Re: EmptyStackException
                          Arbi Sookazian Master

                          Unfortunately, production problems are the most difficult and time-consuming to trouble-shoot and fix.


                          How many Seam apps (and any other JEE apps) are deployed on that server?  Is that server a node in a cluster?

                          • 10. Re: EmptyStackException
                            Bram Biesbrouck Newbie

                            I agree. On one hand it's the only way to troubleshoot your app in a real-life context, on the other hand; tinkering with a live app is so dangerous.


                            The server runs 4 Seam applications, with a total number of a couple hundred visitors a day. Not that big, but apparently big enough to start throwing exceptions. It's a standalone machine.

                            • 11. Re: EmptyStackException
                              Arbi Sookazian Master

                              well that means most likely you won't remote debug the app(s).


                              you will have to look closely at the server.log and stack trace to see if that exception is the root cause or something else is happening prior to that.  And whether it is specific to one Seam app or the JVM in general or what.


                              sorry but that's the best anyone on this forum can do for you.  you probably can't really even profile the app in prod...


                              what JDK/JVM and what version?  maybe it has something to do with the JVM itself???

                              • 12. Re: EmptyStackException
                                Bram Biesbrouck Newbie

                                I appreciate your effort, thanks.
                                I agree that I need to do some more digging first, but I just wanted to know if the Exception mentioned is a common one or not. Apparently, something nasty is going on :)


                                What the JVM concerns:
                                Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.011-b03)
                                Java HotSpot(TM) Server VM (build 1.5.0
                                11-b03, mixed mode)


                                but I don't think that's the problem.


                                Anyhow, again, thanks for the effort, Arbi.

                                • 13. Re: EmptyStackException
                                  Bram Biesbrouck Newbie

                                  Hmmm, I think I found the root cause of the problem:



                                  22:11:31,386 WARN  [ExceptionFilter] exception root cause                                                                                                                           
                                  javax.faces.application.ViewExpiredException: viewId:/app/editAccount.html - View /app/editAccount.html could not be restored.                                                      
                                          at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:186)                                                                                              
                                          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)                                                                                                                    
                                          at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)                                                                                              
                                          at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)                                                                                                    
                                          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)                                                                                                           
                                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)                                                                        
                                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)                                                                                
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)                                                                                           
                                          at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)                                                                                               
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                                                                                           
                                          at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)                                                                                                       
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                                                                                           
                                          at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)                                                                                                     
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                                                                                           
                                          at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)                                                                                                     
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                                                                                           
                                          at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)                                                                                                       
                                          at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)                                                                                           
                                          at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)                                                                                                    
                                          at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)                                                                                                        
                                          at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)                                                                                       
                                          at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)                                                                                                             
                                          at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)                                                                                                       
                                          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:158)                                                                                                          
                                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)                                                                        
                                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)                                                                                
                                          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)                                                                                       
                                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)                                                                        
                                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)                                                                                
                                          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)                                                                                      
                                          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)                                                                                      
                                          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)                                                                         
                                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)                                                                                   
                                          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)                                                                                          
                                          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:157)                                                                            
                                          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)                                                                                        
                                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)                                                                                              
                                          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)                                                                                               
                                          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)                                                                         
                                          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)                                                                                                  
                                          at java.lang.Thread.run(Thread.java:595)



                                  Seems like the end of a conversation or session is the reason for the exception. Is this possible?

                                  • 14. Re: EmptyStackException
                                    Haibo Qiao Newbie
                                    My seam application gets this error very often.

                                    I'm not sure the cause yet, but seems it happens when user re-login or navigating to a page where a conversation starts or ends. below is the error log:


                                    2009-04-16 11:05:53,656 ERROR [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@da629a]
                                    2009-04-16 11:05:53,734 ERROR [org.jboss.seam.web.ExceptionFilter] could not roll back transaction
                                    java.util.EmptyStackException
                                         at java.util.Stack.peek(Stack.java:79)
                                         at java.util.Stack.pop(Stack.java:61)
                                         at org.jboss.seam.transaction.SeSynchronizations.afterTransactionRollback(SeSynchronizations.java:45)
                                         at org.jboss.seam.transaction.UTTransaction.rollback(UTTransaction.java:70)
                                         at org.jboss.seam.web.ExceptionFilter.rollbackTransactionIfNecessary(ExceptionFilter.java:159)
                                         at org.jboss.seam.web.ExceptionFilter.endWebRequestAfterException(ExceptionFilter.java:113)
                                         at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:70)
                                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                         at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                         at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
                                         at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
                                         at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
                                         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
                                         at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                                         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.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                                         at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                                         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                                         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                                         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                                         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                                         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                                         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                                         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                                         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:157)
                                         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                                         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                                         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                                         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                                         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                                         at java.lang.Thread.run(Thread.java:595)
                                    1 2 Previous Next