7 Replies Latest reply on Jul 11, 2007 2:53 AM by Karen Simonyan

    why UserTransactionFactory return null?

    neo tian Newbie

      my test code is below:

      import com.arjuna.mw.wst.UserTransaction;
      import com.arjuna.mw.wst.UserTransactionFactory;
      ....

      UserTransaction ut = UserTransactionFactory.userTransaction();
      if (ut == null) System.out.println("Not got UserTransaction. ");
      try {
      System.out.print("enter....");
      ut.begin();
      System.out.print("transaction started....");
      AddServiceSoapBindingStub binding1;
      binding1 = (AddServiceSoapBindingStub)new AddServiceServiceLocator().
      getaddService(new java.net.URL("http://localhost:8115/testtrans/services/addService"));
      // Time out after a minute
      binding1.setTimeout(60000);
      binding1.add("The first WS");
      System.out.print("call one....");

      DeleteServiceSoapBindingStub binding2;
      binding2 = (DeleteServiceSoapBindingStub)new DeleteServiceServiceLocator().
      getdeleteService(new java.net.URL("http://localhost:8115/testtrans/services/deleteService"));
      // Time out after a minute
      binding2.setTimeout(60000);
      binding2.add("The second WS");
      System.out.print("call two...");
      ut.commit();

      }catch(Exception e) {
      try {
      ut.rollback();
      }catch(Exception e1) {

      }
      e.printStackTrace();
      System.out.print("ERROR");


      }
      System.out.print("OK");


      I use Axis client call webservice , but the "ut " is always null, why?