D
> >
> >
> > setRollbackOnly is used in EJB's using Container managed transactions
> > which is not the case here.
>
> If you're trying to do Bean managed transactions, you need to read up on
> how to do it. See section 11.3.3 of the EJB 1.1 spec, or section 17.3.3
> of the EJB 2.0 pfd 2 spec.
>
> In short, you need to use a UserTransaction object that you get from
> your EJBContext. Note that the example in the 2.0 spec won't work in
> JBoss at the moment - you need to begin the transaction before getting
> your connections.
>
> -danch
>
>
>
There must be something I'm doing terribly wrong.
I redid the example per your suggestion, using JTA transactions and still I
seem to be having the one and only problem:
My new example looks like this:
--------------------------------------------------------
public void ship (String productId, String orderId, int quantity) {
UserTransaction ut = context.getUserTransaction();
try {
ut.begin();
updateOrderItem(productId, orderId);
updateInventory(productId, quantity);
ut.commit();
} catch (Exception ex) {
try {
System.out.println("Cause:" + ex.getMessage());
ut.rollback();
throw new EJBException("Transaction failed: " + ex.getMessage());
} catch (Throwable sqx) {
throw new EJBException("Rollback failed: " + sqx.getMessage());
}
}
}
---------------------------------------------------------
While the transaction is commiting, all looks well. When an application
exception occurs and rollback is called, I get this:
-----------------------------------------------------
RemoteException occurred in server thread; nested 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)
----------------------------------------------------
And the transaction remains open and eventually timeouts....
No clue again. Should go back to school I guess...
Please help me out here,
Jure
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user