Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-8322

"UnsupportedOperationException: no transaction" in Seam2 example ftests

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: EAP_EWP 5.1.2
    • Fix Version/s: EAP_EWP 5.2.0 ER4
    • Component/s: Seam2
    • Labels:
      None
    • Environment:

      Fedora 16 64-bit, Mozilla Firefox 3.6.25, Oracle JDK 1.6.0_30

    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Include custom class which overrides org.jboss.seam.transaction.transaction

      As per https://community.jboss.org/message/712953#712953, it is possible to work around this issue by including a class which overrides org.jboss.seam.transaction.transaction, has higher @Install precedence and looks up the correct JNDI name java:jboss/UserTransaction.

      Put the following class into SEAMPAY_EXAMPLE/src/org/jboss/seam/example/seampay and name it TransactionAS7.java:

      TransactionAS7.java
      package org.jboss.seam.example.seampay;
      
      import static org.jboss.seam.annotations.Install.*;
       
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.transaction.UserTransaction;
       
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Install;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.intercept.BypassInterceptors;
      import org.jboss.seam.transaction.Transaction;
      import org.jboss.seam.util.Naming;
       
      @Name("org.jboss.seam.transaction.transaction")
      @Scope(ScopeType.EVENT)
      @Install(precedence = APPLICATION) // overrides Seam default component of BUILT_IN
      @BypassInterceptors
      public class TransactionAS7 extends Transaction {
       
          @Override
          protected UserTransaction getUserTransaction() throws NamingException {
              final InitialContext context = Naming.getInitialContext();
      
              try {
                return (UserTransaction) context.lookup("java:comp/UserTransaction");
              } catch (final NamingException ne) {
                  try {
                      // JBoss AS7 (with patch from https://issues.jboss.org/browse/AS7-1358)
                      return (UserTransaction) context.lookup("java:jboss/UserTransaction");
                  } catch (final Exception cause) {
                      // ignore this so we let the code carry on to try the final JNDI name
                  }
      
                  try {
                      // Embedded JBoss has no java:comp/UserTransaction
                      final UserTransaction ut = (UserTransaction) context.lookup("UserTransaction");
                      ut.getStatus(); // for glassfish, which can return an unusable UT
                      return ut;
                  } catch (final Exception e) {
                      throw ne;
                  }
              }
          }
      }
      
      Show
      Include custom class which overrides org.jboss.seam.transaction.transaction As per https://community.jboss.org/message/712953#712953 , it is possible to work around this issue by including a class which overrides org.jboss.seam.transaction.transaction , has higher @Install precedence and looks up the correct JNDI name java:jboss/UserTransaction . Put the following class into SEAMPAY_EXAMPLE/src/org/jboss/seam/example/seampay and name it TransactionAS7.java : TransactionAS7.java package org.jboss.seam.example.seampay; import static org.jboss.seam.annotations.Install.*; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.transaction.UserTransaction; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Install; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.intercept.BypassInterceptors; import org.jboss.seam.transaction.Transaction; import org.jboss.seam.util.Naming; @Name( "org.jboss.seam.transaction.transaction" ) @Scope(ScopeType.EVENT) @Install(precedence = APPLICATION) // overrides Seam default component of BUILT_IN @BypassInterceptors public class TransactionAS7 extends Transaction { @Override protected UserTransaction getUserTransaction() throws NamingException { final InitialContext context = Naming.getInitialContext(); try { return (UserTransaction) context.lookup( "java:comp/UserTransaction" ); } catch ( final NamingException ne) { try { // JBoss AS7 (with patch from https://issues.jboss.org/browse/AS7-1358) return (UserTransaction) context.lookup( "java:jboss/UserTransaction" ); } catch ( final Exception cause) { // ignore this so we let the code carry on to try the final JNDI name } try { // Embedded JBoss has no java:comp/UserTransaction final UserTransaction ut = (UserTransaction) context.lookup( "UserTransaction" ); ut.getStatus(); // for glassfish, which can return an unusable UT return ut; } catch ( final Exception e) { throw ne; } } } }
    • Release Notes Text:
      Hide
      As JNDI transaction lookup was changed in JBoss Enterprise Application Platform (EAP) 6, the org.jboss.seam.transaction.transaction Seam 2.2.x component failed to look up transaction contexts. The respective transaction lookup was added to EAP 5 Seam so that transaction lookup from user applications and Seamspace examples now works as expected in EAP 6.
      Show
      As JNDI transaction lookup was changed in JBoss Enterprise Application Platform (EAP) 6, the org.jboss.seam.transaction.transaction Seam 2.2.x component failed to look up transaction contexts. The respective transaction lookup was added to EAP 5 Seam so that transaction lookup from user applications and Seamspace examples now works as expected in EAP 6.
    • Release Notes Docs Status:
      Documented as Resolved Issue
    • Docs QE Status:
      NEW
    • Bugzilla Update:
      Perform

      Description

      Summary:

      Seam version: 2.2.5.EAP5 (included in EAP 5.1.2.GA)
      The seampay example from Seam 2.2 was migrated to EAP6 according to the migration guide on Documentation-Stage (http://documentation-stage.bne.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/6/html/Beta_Documentation/Migrate_Seam_22_Archives_to_JBoss_Enterprise_Application_Platform_6.html)
      and the bug was verified to occur with EAP 6.0.0.ER1.

      This issue was fixed in Seam 2.3, so there is a patch available:
      https://github.com/maschmid/Seam2.3/commit/44a14986a9f6003c5a9ac13fcae9365a5860331e#diff-0

      Related issue: https://issues.jboss.org/browse/AS7-1358

      Bug description:

      The ftest fails in 2 methods:

         [testng] FAILED: payOnceTest
         [testng] java.lang.AssertionError: No money were subtracted from account expected:<991.46> but was:<1001.46>                                                                                       
         [testng]     at org.jboss.seam.example.common.test.seampay.selenium.PaymentTest.payOnceTest(PaymentTest.java:77)                                                                                   
         [testng] ... Removed 25 stack frames                                                            
         [testng] FAILED: payEveryMinuteTest
         [testng] java.lang.AssertionError: No money were subtracted from account after a minute expected:<992.46> but was:<1002.46>
         [testng]     at org.jboss.seam.example.common.test.seampay.selenium.PaymentTest.payEveryMinuteTest(PaymentTest.java:115)
         [testng] ... Removed 25 stack frames
      

      The log contains:

      16:39:56,778 WARN  [org.jboss.seam.contexts.Contexts] (pool-12-thread-1) Exception destroying context : java.lang.UnsupportedOperationException: no transaction
      	at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:36) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.util.Work.workInTransaction(Work.java:58) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:352) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:101) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.cleanup(Asynchronous.java:106) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:99) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:45) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.ThreadPoolDispatcher$RunnableAsynchronous.run(ThreadPoolDispatcher.java:142) [jboss-seam.jar:2.2.5.EAP5]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
      	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
      
      16:39:56,783 ERROR [org.jboss.seam.async.AsynchronousExceptionHandler] (pool-12-thread-1) Exception thrown whilst executing asynchronous call: java.lang.RuntimeException: java.lang.UnsupportedOperationException: no transaction
      	at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:78) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:95) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:45) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.ThreadPoolDispatcher$RunnableAsynchronous.run(ThreadPoolDispatcher.java:142) [jboss-seam.jar:2.2.5.EAP5]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
      	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
      Caused by: java.lang.UnsupportedOperationException: no transaction
      	at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:36) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.util.Work.workInTransaction(Work.java:58) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:53) [jboss-seam.jar:2.2.5.EAP5]
      	... 12 more
      
      16:39:56,789 WARN  [org.jboss.seam.contexts.Contexts] (pool-12-thread-1) Exception destroying context : java.lang.UnsupportedOperationException: no transaction
      	at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:36) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.util.Work.workInTransaction(Work.java:58) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:352) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:101) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.cleanup(Asynchronous.java:106) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:99) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.AsynchronousInvocation.handleException(AsynchronousInvocation.java:95) [jboss-seam.jar:2.2.5.EAP5]
      	at org.jboss.seam.async.ThreadPoolDispatcher$RunnableAsynchronous.run(ThreadPoolDispatcher.java:146) [jboss-seam.jar:2.2.5.EAP5]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) [rt.jar:1.6.0_30]
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
      	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manaRH Marek Novotny
                Reporter:
                rsmeral Ron Šmeral
                Writer:
                Eva Kopalova
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: