Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Local transaction support when BPEL invokes JCA adapter

901275Oct 29 2012 — edited Feb 26 2020
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
This post has been answered by vladodias on Oct 30 2012
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 27 2012
Added on Oct 29 2012
6 comments
915 views