12 Replies Latest reply on Jan 3, 2012 4:28 AM by Jason Porter

    There is a transcation exception sometime

    hantsy bai Master

      There is a transcation exception sometime when I browse the page at the first time after it was deployed.


      Is this a bug?


      How to avoid it?




      java.lang.IllegalStateException: Could not start transaction
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:111)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:101)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsBeforePhase(TransactionPhaseListener.java:82)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.beforePhase(TransactionPhaseListener.java:64)
           at org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:43)
           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:111)
           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:329)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           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 com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
           at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
           at java.lang.Thread.run(Thread.java:662)
      Caused by: javax.transaction.NotSupportedException: BaseTransaction.checkTransactionState - thread is already associated with a transaction!
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:65)
           at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:51)
           at org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:87)
           at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:108)
           ... 40 more
      Caused by: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - thread is already associated with a transaction!
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.checkTransactionState(BaseTransaction.java:259)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:61)
           ... 43 more



      Click HELP for text formatting instructions. Then edit this text and check the preview.

        • 1. Re: There is a transcation exception sometime
          Jason Porter Master

          Would you please post the code you're using and the modules included in your war?

          • 2. Re: There is a transcation exception sometime
            hantsy bai Master

            what codes u want to know...
            I only browsed the home page of the application...the exception is not occurred everytime...

            • 3. Re: There is a transcation exception sometime
              Jason Porter Master

              And beans that are called for that page and beans.xml for a start.

              • 4. Re: There is a transcation exception sometime
                hantsy bai Master

                beans.xml


                <?xml version="1.0" encoding="UTF-8"?>
                <beans 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/beans_1_0.xsd">
                     <interceptors>
                          <class>org.jboss.seam.faces.context.conversation.ConversationBoundaryInterceptor</class>
                     </interceptors>
                     <alternatives>
                          <class>com.telopsys.siorc.bootstrap.ApplicationInitializer</class>
                     </alternatives>
                </beans>
                



                seam-beans.xml


                <?xml version="1.0" encoding="UTF-8"?>
                <beans 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/beans_1_0.xsd">
                     <interceptors>
                          <class>org.jboss.seam.faces.context.conversation.ConversationBoundaryInterceptor</class>
                     </interceptors>
                     <alternatives>
                          <class>com.telopsys.siorc.bootstrap.ApplicationInitializer</class>
                     </alternatives>
                </beans>
                




                View config class



                @ViewConfig
                public interface Pages {
                     
                     static enum Pages1{
                          
                               @FacesRedirect                
                             @UrlMapping(pattern="/login")
                               @ViewPattern("/login.xhtml")
                             LOGIN,
                             
                             @FacesRedirect                
                             @UrlMapping(pattern="/denied")
                               @ViewPattern("/denied.xhtml")
                             DENIED,
                             
                             
                             
                             
                             @FacesRedirect                
                               @ViewPattern("/addressee/*")
                               @LoggedIn
                               @AccessDeniedView("/denied.xhtml")
                             @LoginView("/login.xhtml")
                             ADDRESSEE,
                             
                             
                             @FacesRedirect                
                             @UrlMapping(pattern="/addressee")
                               @ViewPattern("/addressee/addresseeList.xhtml")
                               ADDRESSEE_HOME,
                             
                             @FacesRedirect          
                             @UrlMapping(pattern="/")
                               @ViewPattern("/home.xhtml")
                               @LoggedIn
                             HOME,
                          
                          
                                @FacesRedirect                
                             @ViewPattern("/*")
                             @AccessDeniedView("/denied.xhtml")
                             @LoginView("/login.xhtml")
                                //@LoggedIn
                             ALL;
                          
                     }
                



                When user browsed the home page, if not logged in, it will redirect to the login page.

                • 5. Re: There is a transcation exception sometime
                  hantsy bai Master

                  seam beans content...the before version is not correct, it the beans.xml content.



                  <beans xmlns="http://java.sun.com/xml/ns/javaee"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:ee="urn:java:ee" 
                       xmlns:ss="urn:java:org.jboss.seam.security"
                      xsi:schemaLocation="
                          http://java.sun.com/xml/ns/javaee 
                          http://docs.jboss.org/cdi/beans_1_0.xsd">
                  
                      <ss:IdentityImpl>
                           <ee:modifies />
                           <ss:authenticatorName>siorcAuthenticator</ss:authenticatorName>
                      </ss:IdentityImpl>
                           
                  </beans>
                  

                  • 6. Re: There is a transcation exception sometime
                    hantsy bai Master

                    Can I can consider this is a bug...


                    Obvouisly, it is not caused by my code, but some transaction mechanism in Seam faces or Jobss itself.

                    • 7. Re: There is a transcation exception sometime
                      Jason Porter Master

                      Unfortunately I'm unable to tell where the problem is with what you've provided and the stack trace. Could you please list beans that are being invoked when you render the page?

                      • 8. Re: There is a transcation exception sometime
                        hantsy bai Master

                        Only browsed the home page...
                        There is no bean call.


                        It will redirect to the login page according to my @ViewConfig.


                        <?xml version='1.0' encoding='UTF-8' ?>
                        <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                        <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                                        xmlns:ui="http://java.sun.com/jsf/facelets"
                                        xmlns:h="http://java.sun.com/jsf/html"
                                        xmlns:f="http://java.sun.com/jsf/core"
                                        template="/WEB-INF/layout/template.xhtml"
                                        xmlns:a4j="http://richfaces.org/a4j"
                                        xmlns:rich="http://richfaces.org/rich">
                            <ui:define name="content">
                        
                        
                                <h:panelGrid columns="2" style="width: 100%;">
                                    <rich:panel header="New Mail">
                                        <table cellspacing="0">
                                            <th>Date</th>
                                            <th>From</th>
                                            <th>Subject</th>
                                            <tr>
                                                <td>3 Jun</td>
                                                <td>George</td>
                                                <td>Onward to the next one!</td>
                                            </tr>
                                            <tr>
                                                <td>4 Jun</td>
                                                <td>Costas</td>
                                                <td>Test subject</td>
                                            </tr>
                                            <tr>
                                                <td>4 Jun</td>
                                                <td>John</td>
                                                <td>Regarding the items on order</td>
                                            </tr>
                                        </table>
                                    </rich:panel>
                                    <rich:panel header="Outstandings">
                                        <h:form id="loginForm" rendered="#{not identity.loggedIn}">
                                            <h:messages />
                        
                                            <div class="loginRow">
                                                <h:outputLabel for="name" value="Username" styleClass="loginLabel"/>
                                                <h:inputText id="name" value="#{credentials.username}"/>
                                            </div>
                        
                                            <div class="loginRow">
                                                <h:outputLabel for="password" value="Password" styleClass="loginLabel"/>
                                                <h:inputSecret id="password" value="#{credentials.password}" redisplay="true"/>
                                            </div>
                        
                                            <div class="loginRow">
                        
                                            </div>
                        
                                            <div class="buttons">
                                                <h:commandButton id="login" value="LOGIN" action="#{identity.login}" styleClass="loginButton"/>
                                            </div>     
                        
                                            Tip: you can login with a username/password of demo/demo.
                        
                                        </h:form>    
                                    </rich:panel>
                                    <rich:panel header="Aging Cases">
                                        <ul>
                                            <li>Case 1: this is older than 30 days case</li>
                                            <li>Case 2: this is older than 30 days case</li>
                                            <li>Case 3: this is older than 30 days case</li>
                                            <li>Case 4: this is older than 30 days case</li>
                                            <li>Case 5: this is older than 30 days case</li>
                                            <li>Case 6: this is older than 30 days case</li>
                                            <li>Case 7: this is older than 30 days case</li>
                                            <li>Case 8: this is older than 30 days case</li>
                                        </ul>
                                    </rich:panel>
                                    <rich:panel header="Office forward planning">
                                        <ul>
                                            <li>Officer passport expiry date less than 30 days.</li>
                                            <li>Officer needs new visa to join vessel</li>
                                            <li>Officer taking time off, needs replacement</li>
                                            <li>need to update visa stats, expiring soon.</li>
                                        </ul>
                                    </rich:panel>
                                </h:panelGrid>
                        
                        
                        
                                <br style="clear:both"/>
                            </ui:define>
                        </ui:composition>
                        
                        

                        • 9. Re: There is a transcation exception sometime
                          Andrey Bondarenko Newbie

                          I have the same issue only on Jboss AS 7 + java 1.7.
                          The same application works well on Jboss AS 6 + java 1.7.
                          Maybe it works well with java 1.6 on both AS, but I don't test it yet.
                          And I really thinks it is JB AS 7 bug.

                          • 10. Re: There is a transcation exception sometime
                            Jason Porter Master

                            I'm pretty sure AS7 isn't supported on Java 1.7 yet. Please use 1.6

                            • 11. Re: There is a transcation exception sometime
                              Andrey Bondarenko Newbie

                              But in Release notes for Jboss AS 7 written - Java SE 6 or later (we recommend that you use the latest update available) Java SE 7 can be used with JBoss AS 7.

                              • 12. Re: There is a transcation exception sometime
                                Jason Porter Master

                                I believe we have fixed this with 3.1.0.CR1 and / or 3.1.0.Final.