Hi,

here is my problem:

I have a sample session bean connecting to a postgres datasource (Using JBOSS 
2.2.2 here). A bussiness 
method goes like this:

try {
         con.setAutoCommit(false);
         updateOrderItem(productId, orderId);
         updateInventory(productId, quantity);
         con.commit();
      } catch (Exception ex) {
          try {
                  
            con.rollback();
             throw new EJBException("Transaction failed: " + ex.getMessage());
          } catch (Throwable sqx) {
              throw new EJBException("Rollback failed: " + sqx.getMessage());
          }
      }
   } 


if transaction is committed, all is OK. When an application exception occurs 
(e.g. updateInventory throws an exception) and con.rollback() is called, the 
client gets an exception:

RemoteException occurred in server thread; ne
sted exception
is:
        java.rmi.ServerException: Transaction rolled back
java.rmi.ServerException: RemoteException occurred in server thread; nested 
exception is:
        java.rmi.ServerException: Transaction rolled back
java.rmi.ServerException: Transaction rolled back
        at 
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:248)
        at 
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
        at 
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Unknown 
Source)
        at 
org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(StatelessSessionProxy.java:188)
        at $Proxy1.ship(Unknown Source)
        at warehouse.test.WarehouseClient.main(WarehouseClient.java:37)

The server log is empty, like nothing happened.

The rollback is only supposed to throw an SQLException in case of db backend 
problems. What am I doing wrong here?


Jure

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to