[ http://jira.jboss.com/jira/browse/JBAS-1270?page=comments#action_12315459 ] Ole Husgaard commented on JBAS-1270: ------------------------------------
I agree on the analysis. This code is really simple. It only supports a single UserTransaction, and that USerTransaction only supports transactions on calls to the server where the UserTransaction was obtained from (although JRMPInvokerProxy will set the transaction propagation context of the UserTransaction-started transaction on all calls). Anything better is almost impossible without full cross-server transaction propagation support (which in turn requires full XA between server transaction managers). The only problem is that both the ClientUserTransaction classes (server-side and stand-alone client) are implemented as singletons. So we have to pass the Context to the getInstance() methods, which looks ugly but should not hurt (unless somebody later tries to look up a UserTransaction from another JNDI server, as this would return the first UserTransaction). You may be tempted to get around the last problem by having more than one UserTransaction, but that would mean that JRMPInvokerProxy would need refactoring. > UserTransaction with non default ProviderURL > -------------------------------------------- > > Key: JBAS-1270 > URL: http://jira.jboss.com/jira/browse/JBAS-1270 > Project: JBoss Application Server > Type: Bug > Components: JTA service > Versions: JBossAS-3.2.6 Final > Environment: WinXP Client SP 2, java version 1.4.2_04-b05, jboss-3.2.6 > Reporter: Dirk Niemeier > Assignee: Scott M Stark > Priority: Critical > Fix For: JBossAS-4.0.2 Final, JBossAS-3.2.8 Final > > > Problem to initiate an UserTransaction from client with non default > providerURL. > java.util.Hashtable env = new java.util.Hashtable(); > env.put( Context.PROVIDER_URL, "myserver:1199"); > InitialContext ctx = new InitialContext(env); > javax.transaction.UserTransaction tx = (UserTransaction) > ctx.lookup("UserTransaction"); > The lookup cause an stacktrace like this : > 08:36:54,531 DEBUG [AWT-EventQueue-0] (NamingContext.java:1192) - Failed to > connect to 172.30.1.22:1099 > javax.naming.CommunicationException: Failed to connect to server > 172.30.1.22:1099 [Root exception is javax.naming.ServiceUnavailableException: > Failed to connect to server 172.30.1.22:1099 [Root exception is > java.net.ConnectException: Connection timed out: connect]] > at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:213) > at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1187) > at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:516) > The provider "172.30.1.22:1099" is the default provider in my jndi properties > file which is not online at this time. > I think the problem is in > org.jboss.tm.usertx.client.ClientUserTransactionObjectFactory, which will be > called in lookup handling. > The getUserTransaction() tries to create an new InitialContext with default > parameters. It should use the context available by getObjectInstance(..). > An additional problem to this is in class > org.jboss.tm.usertx.client.ClientUserTransaction : > private synchronized void createSession() > { > // Destroy any old session. > if (session != null) > destroySession(); > try { > // Get a reference to the UT session factory. > UserTransactionSessionFactory factory; > factory = (UserTransactionSessionFactory)new > InitialContext().lookup("UserTransactionSessionFactory"); > // Call factory to get a UT session. > session = factory.newInstance(); > } catch (Exception ex) { > throw new RuntimeException("UT factory lookup failed: " + ex); > } > } > This occurs when begin() is invoked. Same problem with new InitialContext(). > In class ServerVMClientUserTransaction the same problem. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-Development mailing list JBoss-Development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-development