This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,831 Users
  • 2,269,775 Discussions


JMS - UserTransaction - Commit issue

546634 Member Posts: 23
edited Sep 19, 2011 2:53AM in Java Message Service (JMS)
I am moving from WebSphere to Weblogic and have counterd an UserTransaction commit issue.
The code have not been modified, however the logic in Weblogic and Websphere behaves different.

The messagingsystem is Websphere MQ, in Weblogic I have QCF, destinations, host and port etc. in a .bindings file, and I have configured JMS server and JMS modules with corresponding jndi names.

I have verified that this configuration is correct throug a custom develop testtool deployed in WL, message is sent successfully to MQ.

The problem - description
However in my application i'm using UserTransaction and this is not working as expected.
I have two classes that communicate with MQ ( and creates a UserTransaction and communicates with Queuebroker throug a method called "SendToAutoS" this method retrives the corrilationId (for the message sendt to MQ) from Queuebroker.
The SendMessage method creates qcf, queueconnection, queue etc and sends the message to MQ. When i debug this steps (line:queueSender.send(theMessage) I can verify in MQ that a message count is registerted in mq on the correct queue, but it's not shown (since its not commited). However when performing finalize in Queuebroker, which close both session and connection, the messagecount is gone in MQ, and when returing to to perform ut.commit(); there is not any message on Queue.

For me it looks like the message is rolledback when session and connection closes.

Actions tried
If I change this line QueueBroker , transacted to false witch i understand sends message without the need to commit:
boolean transacted = false;
queueSession = queueConnection.createQueueSession(transacted, QueueSession.AUTO_ACKNOWLEDGE);

the message is sendt successfully to MQ. However now either commit or rollback on the UserTransaction is working with transacted=false.

I need the commit and rollback to be done on the UserTransaction for my application.
Anyone have an idea why this is not working?

The files - content
-------------------------------------------------------------------------------- - that creates a usertransaction
ut = ServiceLocator.getInstance().getUserTransaction();
msgCorId = sendToAutoS(userVO, messageSend, transactionQeueSend, transactionQeueFactory);

//SendToAutoS - that calls the Queuebroker method - sendMessage
private String sendToAutoS(UserVO userVO, String message, String transactionQueue, String transactionQueueFactory) throws DaoException {
try {
return QueueBroker.getInstance().sendMessage(message, transactionQueue, transactionQueueFactory);
} catch (BrokerException be) {
log.error("BrokerException", be);
} - that sends the message to MQ
public String sendMessage(String message, String transactionQueue, String transactionQueueFactory) throws BrokerException {
try {
// Get service locator
ServiceLocator sl = ServiceLocator.getInstance();
// Create QueueConnectionFactory with help form service locator
queueConnectionFactory = (QueueConnectionFactory) sl.getQueueConnectionFactory(transactionQueueFactory);
// Create QueueConnection
queueConnection = queueConnectionFactory.createQueueConnection();
// Create QueueSession, transacted - client has to commit !
boolean transacted = true;
queueSession = queueConnection.createQueueSession(transacted, QueueSession.AUTO_ACKNOWLEDGE);
// Create queue with help from service locator
queue = (Queue) sl.getQueue(transactionQueue);
// Create QueueSender
queueSender = queueSession.createSender(queue);
// Create message and sent it
Message theMessage = null;
theMessage = queueSession.createTextMessage(message);
// Log time
long time = System.currentTimeMillis();
// Set log time on message
// Send
// Return unique messageID for message just been sent
return theMessage.getJMSMessageID();
} catch (JMSException je) {
BrokerException ex = new BrokerException();
Object[] o = {"SEND", "String to Autosys = " + message};
throw ex;
} catch (ServiceLocatorException e) {
BrokerException ex = new BrokerException();
throw ex;
} finally {
// Clean up - close connection and session if exist
if (queueConnection != null) {


* Finalize queue handling
* @throws BrokerException e
protected void finalize() throws BrokerException {
try {
// Close connections
} catch (JMSException je) {
BrokerException ex = new BrokerException();
Object[] o = {"FINALIZE", "Close connections" };
throw ex;

Edited by: reZer on 14.sep.2011 13:05

Edited by: reZer on 14.sep.2011 13:06


  • gimbal2
    gimbal2 Senior software engineer NetherlandsMember Posts: 11,949 Gold Trophy
    I know you are trying to send a JMS message, but just because this is true the generic JMS forum is not automatically the place you should ask questions like this. Your real beef is with the container you are using (Weblogic), UserTransaction and persistent JMS messages in combination with the specific JMS provider you are using.

    You will have far more chance to get help with this problem if you ask it in the Weblogic forum which you can also find on this very website. If you make a new post, be sure to create a link to it here so people can follow it.

    And perhaps more specific:

  • ramp
    ramp Member Posts: 2,358
    Are your JMS connections XA?
This discussion has been closed.