[jboss-as7-dev] UserTransaction used by remote clients

Wolf-Dieter Fink wfink at redhat.com
Fri Mar 9 10:07:56 EST 2012


So far so good, after pulling last 7.1.1 SNAPSHOT most problems are gone.

I create a CMT-SLSB with all TxAttributes and check whether it can be 
called (or not) if I have a client side UTx.
Everything works fine.

But with BMT-SLSB.
If I start the Tx at client and call a method the following code return 
with FALSE:
{code}
@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class BMTStatelessSessionBean implements BMTStatelessSession {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(BMTStatelessSessionBean.class);

     @Resource
     UserTransaction uTx;
     @Override
     public boolean checkTransaction() {

         try {
             if(uTx.getStatus() == Status.STATUS_ACTIVE) {
                 return true;
             }
             LOGGER.error("Transaction is not Active as expected! State 
{}",uTx.getStatus());
         } catch (SystemException e) {
             LOGGER.error("Could not check Transaction!",e);
         }
         return false;
     }
{code}

Am I wrong? If I remember correct from my examples this should work in AS5.
Or is it a bug?

========================

Also a question about the lookup at client side.
In AS5 there is a JNDI lookup for UTx and SLSB/SFSB.
If UTx is started there is a configuration possibility to have a 
TxSticky (Utx and bean calls are routed to the same instance as long as 
the Tx is open).
This is without having any knowledge of the server's names!

@Jaikiran - might be a question for you
What about loadbalancing EJB calls? If I remember rightly this was 
planned for 7.1.1.

@David
As you mentioned before should I open an enhancement JIRA for JNDI UTx 
lookup?
I think it is important for customers.

- Wolf

On 03/06/2012 06:28 PM, David M. Lloyd wrote:
> On 03/06/2012 11:17 AM, Wolf-Dieter Fink wrote:
>> Is it possible to lookup and use UserTransaction from a remote-client as
>> in AS5?
>> Or is it planned for further release?
> In AS 7, you can have a connection to more than one server at once.
> Thus you have to specify which server node you want to talk to.  The
> method you want is
> org.jboss.ejb.client.EJBClient#getUserTransaction(String), where the
> argument is the node name.  Note that your connection must already be
> established at this point.
>
> We do not presently have a way to pull a UserTransaction out of JNDI,
> though that could be considered for an enhancement.


More information about the jboss-as7-dev mailing list