ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » How to configure XA on jboss

Post new topic  Reply to topic
 How to configure XA on jboss « View previous topic :: View next topic » 
Author Message
brgmo
PostPosted: Wed Jun 06, 2007 6:45 am    Post subject: How to configure XA on jboss Reply with quote

Master

Joined: 03 Jun 2002
Posts: 227

Hi All,

Can someone please tellme how to configure XA queue connection factory for jboss. I have searched everywhere but couldn't find a clue as how to configure queue connection factory whcih is XA complaint. Any help is greatly appreciated. This is very urgent and any answers will really help me in deciding whether to go with XA or not.

Regards
brgmo.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 06, 2007 6:48 am    Post subject: Re: How to configure XA on jboss Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

brgmo wrote:
any answers will really help me in deciding whether to go with XA or not.


Surely you either have a business requirement for XA coordination (in which case you keep going through the pain) or you don't (in which case your problems are pretty much over).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
brgmo
PostPosted: Wed Jun 13, 2007 1:47 am    Post subject: Reply with quote

Master

Joined: 03 Jun 2002
Posts: 227

Hi All,

Can someone please help me as this is become very critical. I am trying to configure XA on jBoss with websphere mq as the jms provider. Whenever the following line of code is executed:

QueueSession session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

i get the followinf error:


[/quote]


javax.resource.NotSupportedException: Non XA transaction not supported
at org.jboss.resource.adapter.jms.JmsManagedConnection.getXAResource(JmsManagedConnection.java:400)
at org.jboss.resource.connectionmanager.TxConnectionManager.createConnectionListener(TxConnectionManager.java:369)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:569)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:491)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.allocateConnection(JmsSessionFactoryImpl.java:389)
at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createQueueSession(JmsSessionFactoryImpl.java:144)
at stc.business.common.MessageUtils.send(MessageUtils.java:81)
at stc.business.services.ejb.AcknowledgeManager.send(AcknowledgeManager.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
at $Proxy61.send(Unknown Source)
at stc.business.services.ejb.ERFilter.filter(ERFilter.java:137)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
at $Proxy62.filter(Unknown Source)
at com.stc.business.listeners.util.ERFilterForward.forwardMessage(ERFilterForward.java:55)
at com.stc.business.listeners.ejb.ERHighPriority.onMessage(ERHighPriority.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:116)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.contact admin.invoke(contact admin.java:109)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:402)
at org.jboss.ejb.Container.invoke(Container.java:954)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:987)
at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1287)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:266)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:196)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Unknown Source)
10:30:37,578 ERROR [JmsSessionFactoryImpl] could not create session



my wsmq-ds.xml is as below:

Quote:


<?xml version="1.0" encoding="UTF-8"?>

<connection-factories>

<!-- ==================================================================== -->
<!-- WSMQ connection factories -->
<!-- ==================================================================== -->

<!-- XA provider loader and connection factory -->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.mq:service=JMSProviderLoader,name=XAWSMQJMSProvider">
<attribute name="ProviderName">XAWSMQJMSProvider</attribute>
<attribute name="ProviderAdapterClass">
org.jboss.jms.jndi.JNDIProviderAdapter
</attribute>
<!-- The queue connection factory -->
<attribute name="QueueFactoryRef">wsmq/QM.LIFT</attribute>
<!-- The topic factory -->
<attribute name="TopicFactoryRef">wsmq/QM.LIFT</attribute>
</mbean>


<tx-connection-factory>
<jndi-name>WSMQJmsXA</jndi-name>
<rar-name>jms-ra.rar</rar-name>
<xa-transaction/>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/XAWSMQJMSProvider</config-property>
<max-pool-size>20</max-pool-size>
<!-- <security-domain-and-application>JmsXARealm</security-domain-and-application> -->
</tx-connection-factory>


</connection-factories>



my full code is as below
Quote:


/**
*
*/
package stc.business.common;

import java.util.Hashtable;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.XAQueueConnection;
import javax.jms.XAQueueConnectionFactory;
import javax.jms.XAQueueSession;
import javax.naming.Context;
import javax.naming.InitialContext;

import stc.common.utilities.QueueEndpoint;


/**
* @author robert.d.barnes
*
*/
public class MessageUtils {

public static String getMsgId(Message jmsMessage)
{
String msgId = new String();

//Extract the ER message ID from the JMS envelope
try
{
msgId = jmsMessage.getStringProperty("MSGID");
}
catch(JMSException jmsEx)
{
System.out.println("MessageUtils.getMsgId() : MSGID not present");
}

if (msgId == null)
{
msgId = "MSGID NA";
}

return msgId;
}

public static void setMsgId(Message jmsMessage, String msgID)
{
//Extract the ER message ID from the JMS envelope
try
{
jmsMessage.setStringProperty("MSGID", msgID);
}
catch(JMSException jmsEx)
{
System.out.println("MessageUtils.setMsgId() : JMSException setting MSGID");
}
}

public static void send(QueueEndpoint sendTo, String message, String msgID)
{
try
{
Hashtable env = new Hashtable();
Context jndiContext = new InitialContext(env);

// lookup the connection factory in the JNDI context
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) jndiContext.lookup("java:/WSMQJmsXA");

// open the connection
QueueConnection connection = connectionFactory.createQueueConnection();

// create a new session
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

// get the response queue
Queue queueObj = (Queue)jndiContext.lookup(sendTo.GetQueueName());

// create message sender and send the message
QueueSender sender = session.createSender(queueObj);

// make a new (text) message containing the XML message
TextMessage response = session.createTextMessage(message);

MessageUtils.setMsgId(response, msgID);

// send the message
sender.send(response);

// close session, sender, and connection
session.close();
sender.close();
connection.close();

// Test database connectivity & query
// Logger.logger();
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}





Regards
brgmo.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 13, 2007 1:55 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

1) Have you determined there's actually a business requirement for XA then? Or are the business just asking for it because they've read it someplace?

2) My Java is a bit dubious, but there's something I would have expected to be present in your code which I don't see & could explain why you're getting "Non XA transaction" errors....

I could be barking up the wrong tree; Java not my thing at all.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
brgmo
PostPosted: Wed Jun 13, 2007 2:06 am    Post subject: Reply with quote

Master

Joined: 03 Jun 2002
Posts: 227

Can someone help me on this please.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 13, 2007 3:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If you're not talking to a database in the same transaction, you don't need XA.



You didn't provide any meaningful information about your configuration.

To successfully do this in a supported way, with jboss, you need to be using the JCA adapter that comes with MQ v6.0.2.1. Anything else will be unsupported, at least.

Are you using the JCA adapter? Did you read the documentation on how to set that up?

Do you have queue manager running on the same machine?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
brgmo
PostPosted: Wed Jun 13, 2007 4:57 am    Post subject: Reply with quote

Master

Joined: 03 Jun 2002
Posts: 227

Thanks,Jeff. Yes, i am running the queue manager and database on the same machine. From where to get the docs for JCA setup. I am not aware of this.Can you please helpme on this. I am trying to retrieve the message from the queue using MDB under container managed persistance. But when i throw an exception in the code the message disappears from the queue and nothing updated in the database however i a using XA db connection from mysql.

Regards
brgmo.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Jun 13, 2007 5:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The documentation on the MQ JCA adapter is in exactly the same place as the documentation for every other part of MQ.

It is also the first place you should look when you have any questions about MQ.


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to configure XA on jboss
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.