[jboss-jira] [JBoss JIRA] (AS7-6144) Fallback for JBossAppServerJtaPlatform.locateUserTransaction() to look at "java:jboss" if "java:comp" not available

Scott Marlow (JIRA) jira-events at lists.jboss.org
Wed Dec 12 20:21:17 EST 2012


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

Scott Marlow commented on AS7-6144:
-----------------------------------

Good point Stuart, I'll either do that or keep a reference to the UT around to return.  We currently do that for returning the TM + TSR to Hibernate ORM.
                
> Fallback for JBossAppServerJtaPlatform.locateUserTransaction() to look at "java:jboss" if "java:comp" not available
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: AS7-6144
>                 URL: https://issues.jboss.org/browse/AS7-6144
>             Project: Application Server 7
>          Issue Type: Enhancement
>          Components: JPA / Hibernate
>         Environment: JBoss AS 7.1.2.Final, Hibernate 4.1.2.Final
>            Reporter: Marek Posolda
>            Assignee: Scott Marlow
>
> Normally UserTransaction is available in JBoss via JNDI lookup to "java:comp/UserTransaction" . But sometimes this approach does not work (For example if we have custom worker threads in our application or we are starting our AS7 deployment with custom MSC thread before "java:comp" context is available to JNDI)
> So it may be good to fallback to "java:jboss/UserTransaction", which is available in JBoss AS7 even from custom threads.
> Is it possible to change "org.jboss.as.jpa.hibernate4.JBossAppServerJtaPlatform" or "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" to have method locateUserTransaction() similar to this?:
> {code}
> public static final String AS7_NEW_UT_NAME = "java:jboss/UserTransaction";
> @Override
> protected UserTransaction locateUserTransaction() {
>    try {
>       return (UserTransaction) jndiService().locate(UT_NAME);
>    }
>    catch(JndiException jndiException) {         
>       return (UserTransaction) jndiService().locate(AS7_NEW_UT_NAME);         
>    }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list