I use JBoss 3.2.3. Fragment of my code looks like:
Hashtable props = new Hashtable(); props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(InitialContext.PROVIDER_URL, "jnp://" + jbossMachine + ":1099"); props.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); InitialContext ctx = new InitialContext(props); UserTransaction lTrans = (UserTransaction)ctx.lookup("UserTransaction"); try { lTrans.begin(); ... lTrans.commit(); } catch (Exception e) { e.printStackTrace(); try { lTrans.rollback(); } catch (Exception ex) { ex.printStackTrace(); } }
javax.transaction.SystemException: java.lang.RuntimeException: UT factory lookup failed: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at org.jboss.tm.usertx.client.ClientUserTransaction.begin(ClientUserTransaction.java:107) at tracker.clients.editors.ProjectEditor.actionInitialized(ProjectEditor.java:693) at tracker.clients.editors.GenericEditor.actionButton_widgetSelected(GenericEditor.java:346) at tracker.clients.editors.GenericEditor.widgetSelected(GenericEditor.java:321) at tracker.clients.editors.ProjectEditor.widgetSelected(ProjectEditor.java:388)
Moved to the user forums. Do not post user questions in the development forums.
You should report this as a bug at www.sf.net/projects/jboss