problems commiting from session connection

I’m using Tamino4J from within a servlet. When a call is made to my servlet that requires data to be sent to/taken from Tamino a connection is created and stored in context. A TLocalTransaction is obtained from this connection and setup to commit when the back-end process is successful or rollback and changes when there are problems. This all works successfully.

I have now had to build a process the current transaction periodically in some cases because large queries are causing the transaction to fail because they take so long. So I’m trying to get take the connection from my context and get the transaction from it and the commit. I tried

transaction = connection.useLocalTransactionMode()

but this gave me the following exception

com.softwareag.common.instrumentation.contract.ViolatedPrecondition: Violated Precondition: Currently no autocommit mode given. Local transaction mode cannot be initiated!

so then I tried using

transaction = (TLocalTransaction) connection.getTransaction();

but this doesn’t seem to do anything? no exception, and no time out

Should this work? Can I use getTransaction() to make a commit?

Thanks for your help


I case you need some of the stack trace

	at com.softwareag.common.instrumentation.contract.Precondition.check(Unknown Source)
	at com.softwareag.tamino.db.api.connection.TTransactionModeCoordinator.useLocalTransactionMode(Unknown Source)
	at com.softwareag.tamino.db.api.connection.TConnectionImpl.useLocalTransactionMode(Unknown Source)
	at com.teleflex.orbeon.TaminoTransactionProcessor.start(Unknown Source)
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$
	at org.orbeon.oxf.processor.ProcessorImpl.executeChildren(
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(
	at org.orbeon.oxf.processor.pipeline.choose.ConcreteChooseProcessor.start(
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$
	at org.orbeon.oxf.processor.ProcessorImpl.executeChildren(
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor.start(
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$1.getInput(
	at org.orbeon.oxf.processor.pipeline.PipelineProcessor$1.readImpl(
	at org.orbeon.oxf.processor.ProcessorImpl$

Hi all,
I have managed to overcome most of my problems, I now have my connection and local transaction stored in context so my java class can access it on each call rather than creating a new connection each time. At first I was using

TLocalTransaction tran = (TLocalTransaction) connection.getTransaction();

This ran ok, but I eventually got

Tamino access failure (9291, INOXYE9291, Transaction aborted because it has taken too long)

I thought this might cause a problem as getTransations() returns a super class of TLocalTransaction. I now store the transaction in the same way as the connection, but this is still causing problems. Am I right in thinking that periodically calling


will keep the transation running for longer, or is there something else i need to do



Hello Ryan,

The reason behind the exception “Transaction aborted because it has taken too long” is as follows :

The duration of the transaction has exceeded the maximum transaction duration.

This can be caused by several circumstances:

  1. The transaction could have done too much work to complete in the given time frame.
  2. The number of transactions running in parallel has caused considerable delays in transaction execution.
  3. The transaction might have waited for a resource that was held by another transaction for a very long time. In particular, this can happen if the number of XML work threads is too low. In this case, the transactions waiting for a resource block the XML work threads, and no XML work thread is available for the transaction holding the resource.
  4. The transaction had to wait for a free XML work thread for a long time

The possible action for this problem is to exceed maximum transaction duration time using API for particular connection or using Tamino Manager for each connection. You can also exceed the number of XML work threads using Tamino Manager depending on the reason.

Hi Ryan,

  1. If you are using large queries taking long time causing transaction to fail, then you can exceed the maximum transaction duration by setting the parameter.

  2. From the exception ( precondition error) you got , it seems you must be using Local Transaction mode itself. So that is the reason of exception. If you are using autocommit mode then you can switch to local transaction.

  3. getTransaction() method works as follows :

Gets the current active transaction instance. Since not every transaction mode has a transaction instance, this method may return null.

In a J2SE environment this method returns an instance of TLocalTransaction if the connection is in local transaction mode, otherwise null (i.e. if the connection is in auto commit mode.

In a J2EE environment is the TConnection instance was obtained through the Tamino Resource Adapter it will always return null.

So before calling any method on returned value of getTransaction(), it is recommended to check for null. Otherwise you may get NullPointerException.