-
1. Re: UserTransaction throws RuntimeException in client
wufka Feb 4, 2002 8:52 AM (in response to wufka)After studying the jboss-sources, I was able to find a workaround. If I put the following call at the beginning of the main()-Method of the client, everything works fine:
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
System.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
System.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
The reason is that the begin()-method of org.jboss.tm.usertx.client.ClientUserTransaction calls the no-argument constructor InitialContext() to retrieve a UserTransactionSessionFactory. For this to work, the above shown system properties have to be set.
My follow-up question is: Is this a bug or a feature, i.e. should every client (who uses a UserTransaction) have to set these properties? And if so, did I just overlook it, or is this not documented? Or is there a more elegant way to make it work?
Thank you!
Michael -
2. Re: UserTransaction throws RuntimeException in client
johnsbrn Sep 23, 2002 10:55 PM (in response to wufka)use the jndi.properties files in your client classpath
-
3. Re: UserTransaction throws RuntimeException in client
pichler.mi Jan 16, 2004 9:45 AM (in response to wufka)We want to use a user transaction in a web application which should be able to run both inside jboss (.ear) or on a separate web server machine (tomcat).
In the latter configuration, we have got the same problem: passing the JBoss properties to the InitialContext which does the UserTransaction lookup is not enough: utx.begin() then fails, thus the properties must be set as System properties first.
However, we do not want to put jndi.properties that point to JBoss into the classpath of tomcat itself (as far as I can remember that conflicts with the tomcat internal JNDI use).
Is there any other choice to get utx.begin() working?
Or is this a bug in the UserTransaction code (we are using JBoss 3.2.1)?