Version 2



    Standalone client. You want to lookup a UserTransaction from JNDI according to the AS guide . You do it by specifying the properties for the InitialContext programmatically, like so:


             UserTransaction tx = null;
             Properties props = new Properties();
             props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
             props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
             InitialContext ctx = new InitialContext(props);
             tx = (UserTransaction) ctx.lookup("UserTransaction");


    But the lookup does not work, instead you get a java.lang.RuntimeException: UT factory lookup failed




    The properties are not forwarded to the lookup within UserTransactionSessionFactory. For details, see




    For JBoss < 4.0.2, use a file instead of programmatic setup of the jndi properties. For JBoss >= 4.0.2, use the org.jboss.naming.NamingContextFactory instead of org.jnp.interfaces.NamingContextFactory. This factory provides the necessary functionality for the bugfix (remembering the last Properties passed to InitialContext()), see





    Referenced by: