Changing the sample to use distributed transactions

You can try this exercise to test whether or not your J2EE web application server is fully compatible with CICS.

By default, the EJB Bank Account sample is not configured to use distributed transactions. However, you can change this. The SampleServlet servlet contains sample code, which has been commented-out, to turn on client-demarcated transactions. (The SampleServlet.java source file is in the CicsSample.ear file.)

To turn on client-demarcated transactions:
  1. Uncomment the transaction-related code in SampleServlet.java.
  2. Recompile the SampleServlet servlet.
  3. Install the updated copy of the servlet into your web application server.

If you set up the sample to use client-demarcated transactions but your J2EE web application server does not support (or is not configured to use) pure OTS transactions, when you run the sample CICS throws an org.omg.CORBA.INVALID_TRANSACTION exception. This is because a transaction context was sent but CICS could not use it.