How to get the UserTransaction reference on the Client side in EAP 5 / 4

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 4.x

Issue

  • How to get the UserTransaction from a remote standalone client in JBoss EAP 5?

Resolution

Use the org.jboss.naming.NamingContextFactory for the Context.INITIAL_CONTEXT_FACTORY such as:

    Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
    properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
    properties.setProperty("java.naming.provider.url", "jnp://myhost:1099");
    Context context = new InitialContext(properties);
    javax.transaction.UserTransaction tx = (UserTransaction) context.lookup("UserTransaction"); 

Related Solutions

How to get the UserTransaction reference on the Client side in EAP6 - https://access.redhat.com/site/solutions/270863

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.