2 Replies Latest reply on Aug 23, 2007 2:16 AM by Alex Ka

    <transaction:ejb-transaction/> and SeamTest

    Fernando Montaño Expert

      I just migrated my application from Seam 1.2 to Seam 2.0.0.BETA1 using Tomcat 6 and Embedded Jboss, it works like a charm.


      But, when I tried to execute the test suites I got the following exceptions:


      uildfile: D:\Fer\srcEjemplos\Seam\seam2gen\build.xml
      compiletest:
      copytestclasses:
      buildtest:
       [copy] Copying 1 file to D:\Fer\srcEjemplos\Seam\seam2gen\test-build\META-INF
       [copy] Copying 1 file to D:\Fer\srcEjemplos\Seam\seam2gen\test-build
      test:
       [testng] [Parser] Running:
       [testng] D:\Fer\srcEjemplos\Seam\seam2gen\test-build\seam2Test.xml
       [testng] WARN 30-06 21:28:38,824 (UnifiedLoaderRepository3.java:addClassLoader:675) -Tried to add non-URLClassLoader. Ignored
       [testng] WARN 30-06 21:28:40,590 (TxControl.java:<clinit>:266) -[com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using -37c5b421:885:46870348:0
       [testng] WARN 30-06 21:28:44,809 (JDBCPersistenceManager.java:start:143) -
       [testng] JBoss Messaging Warning: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently NONE.
       [testng] Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems.
       [testng] Using an isolation level more strict than READ_COMMITTED may lead to deadlock.
       [testng] ERROR 30-06 21:28:56,106 (SeamPhaseListener.java:afterPhase:189) -uncaught exception
       [testng] java.lang.IllegalStateException: Could not commit transaction
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:589)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.applyRequestValuesPhase(BaseSeamTest.java:666)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:547)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:487)
       [testng] at com.mydomain.sean2gen.test.LoginTest.testLogin(LoginTest.java:77)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       [testng] at java.lang.reflect.Method.invoke(Unknown Source)
       [testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
       [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
       [testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
       [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
       [testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
       [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
       [testng] at org.testng.TestRunner.runWorkers(TestRunner.java:678)
       [testng] at org.testng.TestRunner.privateRun(TestRunner.java:624)
       [testng] at org.testng.TestRunner.run(TestRunner.java:495)
       [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
       [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
       [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
       [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:190)
       [testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
       [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
       [testng] at org.testng.TestNG.run(TestNG.java:699)
       [testng] at org.testng.TestNG.privateMain(TestNG.java:824)
       [testng] at org.testng.TestNG.main(TestNG.java:802)
       [testng] Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.transaction
       [testng] at org.jboss.seam.Component.newInstance(Component.java:1853)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1756)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1735)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1712)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1707)
       [testng] at org.jboss.seam.transaction.Transaction.instance(Transaction.java:96)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:576)
       [testng] ... 29 more
       [testng] Caused by: javax.naming.NameNotFoundException: EjbTransaction not bound
       [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
       [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
       [testng] at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
       [testng] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
       [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
       [testng] at javax.naming.InitialContext.lookup(Unknown Source)
       [testng] at org.jboss.seam.Component.instantiateSessionBean(Component.java:1173)
       [testng] at org.jboss.seam.Component.instantiate(Component.java:1159)
       [testng] at org.jboss.seam.Component.newInstance(Component.java:1849)
       [testng] ... 35 more
       [testng] ERROR 30-06 21:28:56,121 (DebugPageHandler.java:handle:23) -redirecting to debug page
       [testng] javax.naming.NameNotFoundException: EjbTransaction not bound
       [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
       [testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
       [testng] at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
       [testng] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:628)
       [testng] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
       [testng] at javax.naming.InitialContext.lookup(Unknown Source)
       [testng] at org.jboss.seam.Component.instantiateSessionBean(Component.java:1173)
       [testng] at org.jboss.seam.Component.instantiate(Component.java:1159)
       [testng] at org.jboss.seam.Component.newInstance(Component.java:1849)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1756)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1735)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1712)
       [testng] at org.jboss.seam.Component.getInstance(Component.java:1707)
       [testng] at org.jboss.seam.transaction.Transaction.instance(Transaction.java:96)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:576)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226)
       [testng] at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.applyRequestValuesPhase(BaseSeamTest.java:666)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:547)
       [testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:487)
       [testng] at com.mydomain.sean2gen.test.LoginTest.testLogin(LoginTest.java:77)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       [testng] at java.lang.reflect.Method.invoke(Unknown Source)
       [testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
       [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
       [testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
       [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
       [testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
       [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
       [testng] at org.testng.TestRunner.runWorkers(TestRunner.java:678)
       [testng] at org.testng.TestRunner.privateRun(TestRunner.java:624)
       [testng] at org.testng.TestRunner.run(TestRunner.java:495)
       [testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
       [testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
       [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
       [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:190)
       [testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
       [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
       [testng] at org.testng.TestNG.run(TestNG.java:699)
       [testng] at org.testng.TestNG.privateMain(TestNG.java:824)
       [testng] at org.testng.TestNG.main(TestNG.java:802)
       [testng] ERROR 30-06 21:28:56,137 (Contexts.java:flushAndDestroyContexts:335) -could not discover transaction status
      


      It works fine when I remove <transaction:ejb-transaction/> from components.xml.

      I also generated a seam-gen application adding such transaction:ejb-transaction configuration, and I get the same exception.


      Any idea, what is wrong?


      Thanks in advance.