1 Reply Latest reply on Apr 29, 2004 6:14 PM by Adrian Brock

    javax.transaction.SystemException during transaction.begin()

    zakhav Newbie

      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();
       }
      }

      Obtain context and transaction goes well but lTrans.commit() causes me

      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)


      Can anybody help me with this problem?