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

    why UserTransactionFactory return null?

    neotian

      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?

        • 1. Re: why UserTransactionFactory return null?
          kconner

          The user transaction is initialised by a listener in the wstx.war.

          You need to include this into your ear file, along with the other war files in the webapps directory.

          Kev

          • 2. Re: why UserTransactionFactory return null?
            neotian

            Another question.

            should I use interface in client and config service reference in client application web.xml ?

            • 3. Re: why UserTransactionFactory return null?
              neotian

              I include these war, but it is null.

              my ear file structure is:
              commons-logging.jar
              config.jar
              jbossjts.jar
              jbossts-comon.jar
              stax-api-1.0.jar
              ws-c.jar
              ws-t.jar
              wsas.jar
              wscf.jar
              wstx-asl-2.0.3.jar
              wstx.jar
              testclient.war //it's my test client, web services are in another war file
              ws-c.war
              ws-t.war
              wscf.war
              wstx.war

              • 4. Re: why UserTransactionFactory return null?
                kconner

                Are the war files mentioned in you applicaiton.xml? Do you see a deployment message for wstx.war from the tomcat deployer?

                Kev

                • 5. Re: why UserTransactionFactory return null?
                  neotian

                  10:24:49,850 INFO [TomcatDeployer] deploy, ctxPath=/xts, warUrl=.../tmp/deploy/
                  tmp13115testwstrans.ear-contents/ws-c-exp.war/
                  10:24:50,250 INFO [TomcatDeployer] deploy, ctxPath=/ws-t, warUrl=.../tmp/deploy
                  /tmp13115testwstrans.ear-contents/ws-t-exp.war/
                  10:24:50,911 INFO [TomcatDeployer] deploy, ctxPath=/wscf, warUrl=.../tmp/deploy
                  /tmp13115testwstrans.ear-contents/wscf-exp.war/
                  10:24:51,232 INFO [TomcatDeployer] deploy, ctxPath=/wstx, warUrl=.../tmp/deploy
                  /tmp13115testwstrans.ear-contents/wstx-exp.war/
                  10:24:51,492 INFO [EARDeployer] Started J2EE application: file:/D:/JBoss/jboss-
                  4.0.3SP1/server/default/deploy/testwstrans.ear

                  • 6. Re: why UserTransactionFactory return null?
                    kconner

                    This trace shows the XTS wars being deployed but does not appear to include your application. The deployment of the wstx.war will initialise the UserTransaction, amongst other things, so you should have accesss to it after this point.

                    Can you send me a copy of your ear file?

                    • 7. Re: why UserTransactionFactory return null?
                      kardinal

                      Hello Kevin

                      I have the same problem which mentioned in this topic.
                      Can you help me and if necessary I can send you the copy of the my ear file

                      Best regards,
                      Kardinal