Atomikos Forum

SonicMQ (XA) + Oracle (NonXA) : message not sent

Hello.

I'm testing the following case:
- AtomikosNonXADataSourceBean for an Oracle database (jdbc/ettDS)
- AtomikosConnectionFactoryBean for a SonicMQ XAConnectionFactory (jms/ettQCF)
- code which sends a message, then executes some updates in the same transaction

The message is sent with Spring's JmsTemplate, and the transaction is automatically started and committed by Spring.

Everything SEEMS to be working fine (no exception at all, logs which look normal to me), except that the JMS message doesn't seem to be sent in the queue (the receiving application, at the other side of the queue, doesn't receive anything).
If I switch my JMS session to non-transacted, I see the warning messages in the logs telling me that the JMS session won't be part of the global transaction, and the message is sent and received by the receiving application, but of course not transactionnally.

What could be the reason for this problem?

Here are the atomikos logs for the transaction :

09-07-23 11:47:22,343 [http-8080-2] getCompositeTransaction() returning NULL!
09-07-23 11:47:22,343 [http-8080-2] getCompositeTransaction() returning NULL!
09-07-23 11:47:22,343 [http-8080-2] getCompositeTransaction() returning NULL!
09-07-23 11:47:22,343 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: ACTIVE
09-07-23 11:47:22,343 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: ACTIVE
09-07-23 11:47:22,343 [http-8080-2] (1.5) executing task: com.atomikos.timing.PooledAlarmTimer@b8a28b
09-07-23 11:47:22,343 [http-8080-2] Creating composite transaction: 10.3.15.126.tm0000500003
09-07-23 11:47:22,343 [http-8080-2] createCompositeTransaction ( 300000 ): created new ROOT transaction with id 10.3.15.126.tm0000500003
09-07-23 11:47:22,343 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:22,343 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:22,437 [http-8080-2] AtomikosConnectionFactoryBean 'jms/ettQCF': createConnection()...
09-07-23 11:47:22,437 [http-8080-2] AtomikosConnectionFactoryBean 'jms/ettQCF': init...
09-07-23 11:47:22,437 [http-8080-2] atomikos connection pool 'jms/ettQCF': current size: 1/1
09-07-23 11:47:22,437 [http-8080-2] atomikos pooled connection for resource jms/ettQCF: updating last time acquired
09-07-23 11:47:22,468 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: calling toString on JMS driver...
09-07-23 11:47:22,468 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: toString returning progress.message.jimpl.xa.XAConnection@15fc7ad
09-07-23 11:47:22,468 [http-8080-2] atomikos pooled connection for resource jms/ettQCF: returning proxy progress.message.jimpl.xa.XAConnection@15fc7ad
09-07-23 11:47:22,468 [http-8080-2] atomikos connection pool 'jms/ettQCF': got connection from pool, new size: 0/1
09-07-23 11:47:22,468 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: calling toString on JMS driver...
09-07-23 11:47:22,515 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: toString returning progress.message.jimpl.xa.XAConnection@15fc7ad
09-07-23 11:47:22,515 [http-8080-2] AtomikosConnectionFactoryBean 'jms/ettQCF': createConnection() returning progress.message.jimpl.xa.XAConnection@15fc7ad
09-07-23 11:47:22,515 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:22,515 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: creating XA-capable session...
09-07-23 11:47:22,578 [http-8080-2] a SessionHandleState with 0 context(s): notifySessionBorrowed
09-07-23 11:47:22,593 [http-8080-2] a TransactionContext: changing to state com.atomikos.datasource.xa.session.NotInBranchStateHandler@998c09
09-07-23 11:47:22,609 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling toString on JMS driver session...
09-07-23 11:47:22,609 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: toString returning XASession
09-07-23 11:47:22,609 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: returning XASession
09-07-23 11:47:22,609 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: calling hashCode on JMS driver...
09-07-23 11:47:22,609 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: hashCode returning 23054253
09-07-23 11:47:22,609 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: calling hashCode on JMS driver...
09-07-23 11:47:22,609 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: hashCode returning 23054253
09-07-23 11:47:22,640 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling createProducer on JMS driver session XASession
09-07-23 11:47:22,640 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: createProducer returning atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d
09-07-23 11:47:22,640 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling createTextMessage on JMS driver session...
09-07-23 11:47:22,640 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: createTextMessage returning progress.message.jimpl.TextMessage@4f1af2
09-07-23 11:47:22,640 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: send ( message )...
09-07-23 11:47:22,734 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: send ( message , heuristicMessage )...
09-07-23 11:47:22,734 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:22,734 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: detected transaction com.atomikos.icatch.imp.CompositeTransactionImp@e03500
09-07-23 11:47:22,734 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: ACTIVE
09-07-23 11:47:22,734 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: ACTIVE
09-07-23 11:47:22,734 [http-8080-2] a SessionHandleState with 1 context(s): checking XA context for transaction com.atomikos.icatch.imp.CompositeTransactionImp@e03500
09-07-23 11:47:22,750 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: ACTIVE
09-07-23 11:47:22,750 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: ACTIVE
09-07-23 11:47:22,750 [http-8080-2] addParticipant ( XAResourceTransaction: 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31 ) for transaction 10.3.15.126.tm0000500003
09-07-23 11:47:22,750 [http-8080-2] XAResourceTransaction: 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31: about to switch to XAResource
09-07-23 11:47:22,750 [http-8080-2] XAResourceTransaction 10.3.15.126.tm000050000310.3.15.126.tm1: switched to XAResource
09-07-23 11:47:22,750 [http-8080-2] XAResource.start ( 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31 , XAResource.TMNOFLAGS ) on resource jms/ettQCF represented by XAResource instance
09-07-23 11:47:22,859 [http-8080-2] a TransactionContext: changing to state com.atomikos.datasource.xa.session.BranchEnlistedStateHandler@7abf31
09-07-23 11:47:22,859 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: send done.
09-07-23 11:47:22,859 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: send done.
09-07-23 11:47:22,859 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling getTransacted on JMS driver session...
09-07-23 11:47:22,859 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: getTransacted returning true
09-07-23 11:47:22,859 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling equals on JMS driver session...
09-07-23 11:47:22,859 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: equals returning false
09-07-23 11:47:22,890 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: Calling commit/rollback is not allowed on a managed session!
09-07-23 11:47:22,937 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: close...
09-07-23 11:47:22,937 [http-8080-2] atomikos MessageProducer proxy for progress.message.jimpl.QueueSender@a29e6d: close done.
09-07-23 11:47:22,953 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': getConnection ( null )...
09-07-23 11:47:22,968 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': init...
09-07-23 11:47:22,968 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': getConnection ( null )...
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': init...
09-07-23 11:47:23,046 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,046 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,046 [http-8080-2] atomikos connection pool 'jdbc/ettDS': current size: 2/2
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXAPooledConnection: updating last time acquired
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXAPooledConnection: no test query, skipping test
09-07-23 11:47:23,046 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXAPooledConnection: creating connection proxy...
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling toString on vendor connection...
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: toString returning oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXAPooledConnection: returning proxy oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] atomikos connection pool 'jdbc/ettDS': got connection from pool, new size: 2/2
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling toString on vendor connection...
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: toString returning oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': returning oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling toString on vendor connection...
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: toString returning oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] AtomikosNonXADataSourceBean 'jdbc/ettDS': returning oracle.jdbc.driver.T4CConnection@eac0b4
09-07-23 11:47:23,046 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,046 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: ACTIVE
09-07-23 11:47:23,046 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: ACTIVE
09-07-23 11:47:23,046 [http-8080-2] addParticipant ( com.atomikos.jdbc.nonxa.AtomikosNonXAParticipant@de299f ) for transaction 10.3.15.126.tm0000500003
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling prepareStatement on vendor connection...
09-07-23 11:47:23,046 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: prepareStatement returning oracle.jdbc.driver.T4CPreparedStatement@17ebc89
09-07-23 11:47:23,156 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,156 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling prepareStatement on vendor connection...
09-07-23 11:47:23,156 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: prepareStatement returning oracle.jdbc.driver.T4CPreparedStatement@387bc2
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling prepareStatement on vendor connection...
09-07-23 11:47:23,171 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: prepareStatement returning oracle.jdbc.driver.T4CPreparedStatement@4507ed
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] getCompositeTransaction()  returning instance with id 10.3.15.126.tm0000500003
09-07-23 11:47:23,171 [http-8080-2] commit() done (by application) of transaction 10.3.15.126.tm0000500003
09-07-23 11:47:23,250 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: PREPARING
09-07-23 11:47:23,250 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: PREPARING
09-07-23 11:47:23,250 [http-8080-2] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@a8be43
09-07-23 11:47:23,250 [http-8080-2] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@635f9e
09-07-23 11:47:23,250 [http-8080-2] ThreadFactory: creating new thread: Atomikos:6
09-07-23 11:47:23,250 [http-8080-2] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@3b4f79
09-07-23 11:47:23,250 [Atomikos:6] XAResource.end ( 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31 , XAResource.TMSUCCESS ) on resource jms/ettQCF represented by XAResource instance
09-07-23 11:47:23,265 [Atomikos:6] About to call prepare on XAResource instance:
09-07-23 11:47:23,265 [Atomikos:6] XAResource.prepare ( 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31 ) returning OK on resource jms/ettQCF represented by XAResource instance
09-07-23 11:47:23,265 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: IN_DOUBT
09-07-23 11:47:23,265 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: IN_DOUBT
09-07-23 11:47:23,265 [http-8080-2] prepare() of Coordinator  10.3.15.126.tm0000500003 returning YES vote
09-07-23 11:47:23,265 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: COMMITTING
09-07-23 11:47:23,296 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: COMMITTING
09-07-23 11:47:23,296 [http-8080-2] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@5b644b
09-07-23 11:47:23,296 [http-8080-2] (1.5) executing task: com.atomikos.icatch.imp.Propagator$PropagatorThread@157e43
09-07-23 11:47:23,296 [Atomikos:6] XAResource.commit ( 31302E332E31352E3132362E746D30303030353030303033:31302E332E31352E3132362E746D31 , false ) on resource jms/ettQCF represented by XAResource instance
09-07-23 11:47:23,296 [Atomikos:5] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: committing on connection...
09-07-23 11:47:23,359 [Atomikos:5] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: resetting autoCommit to true
09-07-23 11:47:23,359 [Atomikos:5] ThreadLocalConnection: not reusable yet
09-07-23 11:47:23,359 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entering state: TERMINATED
09-07-23 11:47:23,359 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 : stopping timer...
09-07-23 11:47:23,359 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 : disposing statehandler TERMINATED...
09-07-23 11:47:23,359 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 : disposed.
09-07-23 11:47:23,359 [http-8080-2] JmsRequeueSynchronization: detected termination of transaction com.atomikos.icatch.imp.CompositeTransactionImp@e03500
09-07-23 11:47:23,359 [http-8080-2] a TransactionContext: changing to state com.atomikos.datasource.xa.session.NotInBranchStateHandler@aea944
09-07-23 11:47:23,359 [http-8080-2] JmsRequeueSynchronization: is in terminated state ? false
09-07-23 11:47:23,359 [http-8080-2] Coordinator 10.3.15.126.tm0000500003 entered state: TERMINATED
09-07-23 11:47:23,359 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: Calling commit/rollback is not allowed on a managed session!
09-07-23 11:47:23,453 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: isClosed()...
09-07-23 11:47:23,453 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: isClosed() returning false
09-07-23 11:47:23,453 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling getWarnings on vendor connection...
09-07-23 11:47:23,453 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: getWarnings returning null
09-07-23 11:47:23,453 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: calling clearWarnings on vendor connection...
09-07-23 11:47:23,546 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: clearWarnings returning null
09-07-23 11:47:23,546 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: close...
09-07-23 11:47:23,546 [http-8080-2] ThreadLocalConnection: detected reusability
09-07-23 11:47:23,546 [http-8080-2] AtomikosNonXAPooledConnection: notifying listener: atomikos connection pool 'jdbc/ettDS'
09-07-23 11:47:23,546 [http-8080-2] atomikos connection pool 'jdbc/ettDS': connection AtomikosNonXAPooledConnection became available, notifying potentially waiting threads
09-07-23 11:47:23,546 [http-8080-2] atomikos non-xa connection proxy for oracle.jdbc.driver.T4CConnection@eac0b4: close done.
09-07-23 11:47:23,546 [http-8080-2] a SessionHandleState with 1 context(s): entering notifySessionClosed
09-07-23 11:47:23,546 [http-8080-2] a SessionHandleState with 1 context(s): delegeting session close to a TransactionContext
09-07-23 11:47:23,546 [http-8080-2] a TransactionContext: changing state to com.atomikos.datasource.xa.session.TerminatedStateHandler@eae613
09-07-23 11:47:23,546 [http-8080-2] a TransactionContext: changing to state com.atomikos.datasource.xa.session.TerminatedStateHandler@eae613
09-07-23 11:47:23,546 [http-8080-2] a SessionHandleState with 0 context(s): all contexts terminated, firing TerminatedEvent
09-07-23 11:47:23,546 [http-8080-2] atomikos pooled connection for resource jms/ettQCF: a session has terminated, is connection now available ? false
09-07-23 11:47:23,562 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: destroying JMS session atomikos xa session proxy for resource jms/ettQCF
09-07-23 11:47:23,578 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: closing session atomikos xa session proxy for resource jms/ettQCF - is terminated ? true
09-07-23 11:47:23,578 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: destroying JMS session atomikos xa session proxy for resource jms/ettQCF
09-07-23 11:47:23,578 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: calling close on JMS driver session...
09-07-23 11:47:23,656 [http-8080-2] atomikos xa session proxy for resource jms/ettQCF: close returning null
09-07-23 11:47:23,656 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: intercepting call to close
09-07-23 11:47:23,656 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: closing 0 session(s)
09-07-23 11:47:23,656 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: is available ? true
09-07-23 11:47:23,656 [http-8080-2] atomikos pooled connection for resource jms/ettQCF: a session has terminated, is connection now available ? true
09-07-23 11:47:23,656 [http-8080-2] atomikos connection proxy for resource jms/ettQCF: closing connection and all 0 session(s)
09-07-23 11:47:23,656 [http-8080-2] atomikos pooled connection for resource jms/ettQCF: notifying listener: atomikos connection pool 'jms/ettQCF'
09-07-23 11:47:23,656 [http-8080-2] atomikos connection pool 'jms/ettQCF': connection atomikos pooled connection for resource jms/ettQCF became available, notifying potentially waiting threads
Jean-Baptiste Nizet Send private email
Thursday, July 23, 2009
 
 
I would say you missed something in the Spring config.

Can you send a copy of your JMS template and connection factory bean configs ?
Ludovic Orban Send private email
Friday, July 24, 2009
 
 
Hello Ludovic, and thanks for your help.

Here is my transaction manager configuration :

    <tx:annotation-driven transaction-manager="txManager"/>

    <bean id="atomikosTransactionManager"
          class="com.atomikos.icatch.jta.UserTransactionManager"
        init-method="init" destroy-method="close">

      <!--
            when close is called, should we force
            transactions to terminate or not?
      -->
      <property name="forceShutdown" value="false" />
    </bean>

    <!--
        Also use Atomikos UserTransactionImp,
        needed to configure Spring
    -->
    <bean id="atomikosUserTransaction"
      class="com.atomikos.icatch.jta.UserTransactionImp">

      <property name="transactionTimeout" value="300" />
    </bean>


    <!--
      Configure the Spring framework to use JTA transactions from Atomikos
    -->
    <bean id="txManager"
          class="org.springframework.transaction.jta.JtaTransactionManager">
      <property name="transactionManager" ref="atomikosTransactionManager" />
      <property name="userTransaction" ref="atomikosUserTransaction" />
    </bean>

Here is my JMSTemplate configuration :

    <bean id="jmsJndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>
                <prop key="java.naming.provider.url">tcp://FRMESNTESB01D.laboboiron.com:2506</prop>
                <prop key="com.sonicsw.jndi.mfcontext.domain">dmBoironDev</prop>
                <prop key="java.naming.security.principal">Administrator</prop>
                <prop key="java.naming.security.credentials">Administrator</prop>
            </props>
        </property>
    </bean>

    <!-- la queue connection factory est dans le contexte de tomcat, et est liée au
        contexte java:comp/env via le web.xml et le context.xml -->
    <bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:comp/env/jms/queueConnectionFactory" />
    </bean>

    <!-- la queue est dans l'arbre JNDI de sonic -->
    <bean id="ramassageDestination"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jmsJndiTemplate"/>
        </property>
        <property name="jndiName">
            <value>etd.LigneDExpedition</value>
        </property>
    </bean>

    <bean id="jmsTemplate"
          class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <ref bean="queueConnectionFactory"/>
        </property>
        <property name="sessionTransacted" value="true"/>
    </bean>

The JDBC and JMS connection pools are defined in Tomcat, using classes similar to the one at http://www.atomikos.com/Documentation/Tomcat6Integration33?refresh=on#Bean_Factory_java.

In the context.xml file of my webapp :
  <ResourceLink global="jdbc/ettDataSource" name="jdbc/dataSource" type="javax.sql.DataSource"/>
  <ResourceLink global="jms/ettQCF" name="jms/queueConnectionFactory" type="javax.jms.QueueConnectionFactory"/>

In the server.xml file of Tomcat :
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
        UserDatabaseRealm to authenticate users
    -->
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
   
    <Resource
        name="jdbc/ettDataSource"
        auth="Container"
        type="com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean"
        factory="com.boiron.atomikos.NonXABeanFactory"
        uniqueResourceName="jdbc/ettDS"
        driverClassName="oracle.jdbc.OracleDriver"
        url="jdbc:oracle:thin:@oradevg.laboboiron.com:1521:ORA"
        user="OPS$NIZET_JB"
        password="NIZET_JB"
    />
    <Resource
        name="jms/ettQCF"
        auth="Container"
        type="com.atomikos.jms.AtomikosConnectionFactoryBean"
        factory="com.boiron.atomikos.SonicMQBeanFactory"
        uniqueResourceName="jms/ettQCF"
        initialContextFactory="com.sonicsw.jndi.mfcontext.MFContextFactory"
        providerUrl="tcp://FRMESNTESB01D.laboboiron.com:2506"
        securityPrincipal="Administrator"
        securityCredentials="Administrator"
        jndiName="devXAQueueConnectionFactory"
        domain="dmBoironDev"
    />

   
  </GlobalNamingResources>
 
You can find the classes of the factories at http://dl.free.fr/ahkVVOUJP and http://dl.free.fr/rjQYC9Tex

Thanks again for your help.

JB.
Jean-Baptiste Nizet Send private email
Monday, July 27, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics