Hi all,
I've implemented a BPEL process consisting of multiple invoke activities to my (custom) JCA Resource Adapter which connects to an EIS.
My concern is to support local transactions. Here are some code snippets describing what I've done so far.
Declare the transaction support at deployment time (ra.xml)
<transaction-support>LocalTransaction</transaction-support>
Implementer class of
ManagedConnection interface
public class MyManagedConnection implements ManagedConnection {
...
public XAResource getXAResource() throws ResourceException {
throw new NotSupportedException("XA Transactions not supported");
}
public LocalTransaction getLocalTransaction() throws ResourceException {
return new MyLocalTransaction(this);
}
public void sendTheEvent(int eventType, Object connectionHandle) {
ConnectionEvent event = new ConnectionEvent(this, eventType);
if (connectionHandle != null) {
event.setConnectionHandle(connectionHandle);
}
ConnectionEventListener listener = getEventListener();
switch (eventType) {
case ConnectionEvent.CONNECTION_CLOSED:
listener.connectionClosed(event); break;
case ConnectionEvent.LOCAL_TRANSACTION_STARTED:
listener.localTransactionStarted(event); break;
case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED:
listener.localTransactionCommitted(event); break;
case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK:
listener.localTransactionRolledback(event); break;
case ConnectionEvent.CONNECTION_ERROR_OCCURRED:
listener.connectionErrorOccurred(event); break;
default: break;
}
}
}
Implementer class of
LocalTransaction interface
public class MyLocalTransaction implements javax.resource.spi.LocalTransaction {
private MyManagedConnection mc = null;
public MyLocalTransaction(MyManagedConnection mc) {
this.mc = mc;
}
@Overide
public void begin() throws ResourceException {
mc.sendTheEvent(ConnectionEvent.LOCAL_TRANSACTION_STARTED, mc);
}
@Override
public void commit() throws ResourceException {
eis.commit(); //eis specific method
mc.sendTheEvent(ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, mc);
}
@Override
public void rollback() throws ResourceException {
eis.rollback(); //eis specific method
mc.sendTheEvent(ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK, mc);
}
}
Uppon BPEL process completion,
MyLocalTransaction.commit() is called. However,
localTransactionCommitted(event) fails and I get the following error:
Error committing transaction:; nested exception is: weblogic.transaction.nonxa.NonXAException: java.lang.IllegalStateException:
[Connector:199175]This ManagedConnection is managed by container for its transactional behavior and has been enlisted to JTA transaction by container;
application/adapter must not call the local transaction begin/commit/rollback API. Reject event LOCAL_TRANSACTION_COMMITTED from adapter.
Could someone give me some directions to proceed ?
My current installation consists of:
1. Oracle SOA Suite / JDeveoper 11g (11.1.1.4.0),
2. WebLogic Server 10.3.4
Thank you for your time,
George