[jboss-jira] [JBoss JIRA] (AS7-1358) UserTransaction not available to non-EE threads

yangju (Commented) (JIRA) jira-events at lists.jboss.org
Thu Oct 27 15:34:45 EDT 2011


    [ https://issues.jboss.org/browse/AS7-1358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638153#comment-12638153 ] 

yangju commented on AS7-1358:
-----------------------------

I tried jboss 7.0.2Final and Seam 3.1.0.Beta4. The non-EE thread (application managed thread) does not have transaction. We use seam transaction (@TransactionAttritbute).
For example:
I have a service:
@TransactionAttribute
Class MyService {
@Inject @MyEm EntityManager em;
   public void updateDatabase(){
em.persist(...);
}
}

If I pass this service to a non-EE thread, the updateDatabase() will throw exception:
at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:43) [seam-transaction-3.1.0.Beta4.jar:]
	at org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:87) [seam-transaction-3.1.0.Beta4.jar:]
	at org.jboss.seam.transaction.Work.workInTransaction(Work.java:46) [seam-transaction-3.1.0.Beta4.jar:]
	at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:148) [seam-transaction-3.1.0.Beta4.jar:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_24]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_24]
	at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_24]
	at org.jboss.interceptor.proxy.InterceptorInvocation$InterceptorMethodInvocation.invoke(InterceptorInvocation.java:72) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
	at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:82) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
	at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
	at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
	at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
	at 

If I inject this service to Arquillian, the transaction works.
	
                
> UserTransaction not available to non-EE threads
> -----------------------------------------------
>
>                 Key: AS7-1358
>                 URL: https://issues.jboss.org/browse/AS7-1358
>             Project: Application Server 7
>          Issue Type: Feature Request
>          Components: Transactions
>    Affects Versions: 7.0.0.Final
>            Reporter: Chris Lowe
>            Assignee: Jonathan Halliday
>             Fix For: 7.0.1.Final
>
>
> JBoss Seam offers Asynchronous behaviour for non-EJB environments using a Quartz dispatcher. Asynchronous behaviour may also make use of Seam's @Transactional marker to demarcate tx boundaries.
> Since testing one of our applications in AS7 I noticed Seam "could not discover transaction status" error messages reported as our application ran async sections of code.
> Examining the Seam code, I could see that Seam would make two attempts to access a JNDI UserTransaction resource:
> 1 - context.lookup("java:comp/UserTransaction");
> If an NameNotFoundException is thrown, then attempt:
> 2 - context.lookup("UserTransaction");
> Under AS6 and below, the latter attempt would succeed.  Under AS7 attempts are currently failing.
> While looking into this issue I came across the following developer discussion which suggests that it might be possible to add a "java:/jboss/UserTransaction" resource:
> http://lists.jboss.org/pipermail/jboss-as7-dev/2011-June/002298.html
> Further discussion on my AS7 user forum thread lead to the suggestion that I myself might add this behaviour.
> I have followed the implementation hints and light testing has been successful (with appropriate mods to Seam to use the new resource name).  I aim to perform some more thorough testing on this shortly and submit a patch against this issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list