4 Replies Latest reply on Jan 20, 2004 7:01 AM by laurentjacotot

    URGENT : UserTransaction not bound

    laurentjacotot

      Hello,

      i am getting the following error from a stateless ejb :

      javax.transaction.UserTransaction not bound

      can anybody help me

      thanks in advance

      laurent

      here is the code that works fine with Weblogic but not with Jboss

      public void Insert_phosphorimagertemp(ArrayList in) throws Exception, ASystemException
      {

      phosphorimagertemp_object tr = null;
      UserTransaction tx = null;
      boolean inTransaction = false;
      int count = 0;


      try
      {
      tx = (javax.transaction.UserTransaction) cntxt.lookup("javax.transaction.UserTransaction");
      tx.begin();
      connection = getConnection();
      connection.setAutoCommit(false);
      prepStmt = connection.prepareStatement(insertStatement);
      inTransaction = true;


      for (int i = 0; i < in.size(); i++) //in.size()
      {

      tr = (phosphorimagertemp_object)in.get(i);
      prepStmt.setString(1, (tr.getgel().toString()).trim());
      count = prepStmt.executeUpdate();
      if (count != 1)
      {
      System.out.println("After Insert_phosphorimagertemp update return is " + count + ", should be 1");
      throw new ASystemException("After Insert_phosphorimagertemp update return is " + count);
      }
      }
      prepStmt.close();
      connection.close();
      tx.commit();

      }
      catch(Exception ee)
      {
      System.out.println("Exception @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp()" + ee.getMessage());

      try {
      // rollback
      if (inTransaction){
      tx.rollback();
      System.out.println("Succesfull transaction @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp() - commited");
      throw new ASystemException("Transaction OK @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp() :" + ee.getMessage());
      // there was no thorw stmt here before
      }
      else{
      System.out.println("Could not roll back @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp()" + ee.getMessage());
      throw new ASystemException("Failed transaction @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp() :" + ee.getMessage());
      }
      }
      catch(Exception e)
      {
      System.out.println("No Insert in DataBase @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp()" + e.getMessage());
      throw new ASystemException(" No Insert in DataBase @ ejbphosphorimagertempEJB.Insert_phosphorimagertemp()" + e.getMessage());
      }
      }




      }