6 Replies Latest reply on Jun 10, 2010 9:33 AM by Michal Szymanski

    Problem with transaction in Jboss (programatic model)

    Michal Szymanski Newbie

      I try to use  programatic model transaction for Axis2 Webservice, for this we deployed Axis2 and our services on Jboss 5.1. I created XA datasource and without 'begin'  all transaction are autocommited and it works ok. But when I put 
      UserTransaction.userTransaction().begin();  I've got following error:

      14:32:57,250 INFO  [STDOUT] [ERROR] loader constraint violation: loader (instance of org/apache/axis2/deployment/DeploymentCl
      assLoader) previously initiated loading for a different type with name "javax/transaction/UserTransaction"


      Should I switch off  local transaction or maybe there is other error?
      Below part of my program.

      import java.sql.Connection;
          import java.sql.SQLException;
          import java.sql.Statement;


          import javax.naming.InitialContext;
          import javax.naming.NamingException;
          import javax.sql.DataSource;
          import javax.transaction.HeuristicMixedException;
          import javax.transaction.HeuristicRollbackException;
          import javax.transaction.NotSupportedException;

          import javax.transaction.RollbackException;
          import javax.transaction.SystemException;
          import org.apache.log4j.Logger;
          import com.arjuna.ats.jta.UserTransaction;


          public CreateServiceResponse createService(String token, String serviceName, String serviceType, String consolePassword) {


              InitialContext dic;
              try {
                  dic = new InitialContext();
                  DataSource dsUms = (DataSource) dic.lookup("java:jdbc/UMSDbDS");           
                  Connection conUms = null;
                  conUms = dsUms.getConnection();
                  try {
                      UserTransaction.userTransaction().begin();        /* EXCEPTION  HAPPENS HERE !! */
                  } catch (NotSupportedException e) {
                      // TODO Auto-generated catch block
                  } catch (SystemException e) {
                      // TODO Auto-generated catch block
                  Statement stmtUms = conUms.createStatement();;
                  String sql = "update dict.cfg_dictionary set description='DUPAUMS_1'";


      Michal Szymanski