5 Replies Latest reply on Jun 18, 2009 11:45 PM by tony.herstell1

    Unexpected Error Transaction is not active

    tony.herstell1

      Any ideas why I would get this:


      Unexpected Error Transaction is not active: tx=TransactionImple < ac, BasicAction: 7f000001:a2f0:4a343d6f:111f status: ActionStatus.ABORT_ONLY >



      I switched to Seam Transactions and now I get this.


      A clue where to look?

        • 1. Re: Unexpected Error Transaction is not active
          tony.herstell1

          When not logged in and I click this then




          http://localhost/site/home.seam?eventId=7&actionMethod=home.xhtml%3AnewsItemController.enter%28%29





          things work.


          BUT when I log in and then go to the same link I get the exception.



          • 2. Re: Unexpected Error Transaction is not active
            tony.herstell1

            Really appreciate any help on this.


            It's a live site and my poor users are getting a very poor experience (and I am getting nagged to death to fix it).


            Live site (where its happening) is http://www.selwynequestriancentre.co.nz.



            User goes to event view page via:


            <s:link value="UNGRADED #{messages.more_info}" 
                 action="#{newsItemController.enter()}" propagation="none" converter="javax.faces.Long">
                 <f:param name="eventId" value="7"/>
            </s:link>
            



            which lands into the controller as:



            @SuppressWarnings("serial")
            @Stateful
            @Conversational
            @Name("newsItemController")
            
            ...
            
            @RequestParameter
            private Long eventId;
            
            ...
            
            @Override
            @Begin
            public String enter() {
                 String nextPageToReturn = null;
                 log.info(">enter");
                 this.event=null;
                 if (eventId != null) {
                      log.info("Param was :"+eventId);
                      event = (Event)entityManager.createQuery("from Event e where e.id = :id").setParameter("id", eventId).getSingleResult();
                      if (event != null) {
                           nextPageToReturn = "showEvent";
                      }
                 }
                 log.info("<enter");
                 return nextPageToReturn;
            }
            




            which then directs using:



            <navigation-case>
                 <from-outcome>showEvent</from-outcome>
                 <to-view-id>/pages/events/showEvent.xhtml</to-view-id>
                 <redirect />
            </navigation-case>
            



            to showEvent.xhtml.




            Why does being logged in fail but having to re-direct via re-direct work????


            <page view-id="/pages/events/showEvent.xhtml" login-required="false" conversation-required="true">
               <description>Reason: Show an Event (#{event.description}:#{event.id})</description>
            </page>




            <!-- Config for login re-direct -->
            <event type="org.jboss.seam.security.notLoggedIn">
                 <action execute="#{redirect.captureCurrentView}" />
                 <action execute="#{identity.tryLogin}"/>
            </event>
            
            <event type="org.jboss.seam.security.loginSuccessful">
                 <action execute="#{redirect.returnToCapturedView}" />
            </event>




            Txn's are quite confusing and this ONLY wnet wrong when I moved to Seam Managed Txn's to fix other bugs.

            • 3. Re: Unexpected Error Transaction is not active
              tony.herstell1

              Fixed.

              • 4. Re: Unexpected Error Transaction is not active

                You care to tell us what the problem was? Thx

                • 5. Re: Unexpected Error Transaction is not active
                  tony.herstell1

                  Facelet page was doing a call to a controller to get some data for the page.


                  Facelet page is over 1500 lines long (even excluding the template and includes!) so a lot could go wrong...


                  The data was null (my fault in not explaining the complete requirement to the programmer) causing the method to throw a a null pointer exception and thus automatically get the txn rolled back as it was during the render phase for a page.


                  IF I had had looked at ALL of the stack trace at the beginning properly I would have seen the error in there... but I had blinkers on as I just (after a few years of seam) am figuring out that there are multiple Transaction Handlers (all very confusing and i.m.h.o and not well documented in the seam manual - and most examples use Container managed Txn) and had just changed over (I think!) to JUST use Seam managed transactions so assumed it was this.


                  I had never seen this type of error before so that also threw me off track.