hodneeri [
http://community.jboss.org/people/hodneeri] created the discussion
"Not a JBossDestination when writing to a websphere MQ using Websphere resource
adapter"
To view the discussion, visit:
http://community.jboss.org/message/562883#562883
--------------------------------------------------------------
Hi all,
I have a problem when connecting between JBoss 4.3.0 and a Websphere MQ.
I have followed the procedure described here:
http://www.ibm.com/developerworks/websphere/library/techarticles/0710_rit...
http://www.ibm.com/developerworks/websphere/library/techarticles/0710_rit...
Earlier I have made a connection to a Websphere MQ using an MDB like described in the
document, and it works fine. It picks up incomming messages as expected.
Now I want to write a message from my application to a Websphere MQ, but then I get
trouble. Here is my setup:
I have deployed wmq.jmsra.rar in the deploy-directory on my jboss, and I have put
+com.ibm.mqetclient.jar+ in the lib-directory. These seem to work fine, and are also used
by my MDB which is already working.
In +wmq.jmsra-ds.xml+, my mbean look like this (I have swapped the names of queues and
hosts with examples):
<!-- mbeans defining JCA administered objects -->
<mbean code="org.jboss.resource.deployment.AdminObject"
name="jca.wmq:name=ivtqueue">
<!-- Bind this AdminObject with the JNDI name IVTQueue -->
<attribute name="JNDIName">
IVTQueue
</attribute>
<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>
<!-- this admin object is a javax.jms.Queue -->
<attribute name="Type">javax.jms.Queue</attribute>
<!--
Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent
to this queue will have their expiry time overridden so that messages never expire
-->
<attribute name="Properties">
baseQueueManagerName=ExampleQueueManager
baseQueueName=ExampleQueueName
<!--expiry=EXP_UNLIMITED-->
</attribute>
</mbean>
My tx connectionfactory:
<tx-connection-factory>
<!-- Bind this ConnectionFactory with the JNDI name IVTCF -->
<jndi-name>IVTCF</jndi-name>
<!-- Indicate that the connection factory supports XA transactions -->
<xa-transaction />
<!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar -->
<rar-name>wmq.jmsra.rar</rar-name>
<!-- connection-definition is the ConnectionFactory interface
defined in the ra.xml -->
<connection-definition>
javax.jms.ConnectionFactory
</connection-definition>
<!--
Configuration for the ConnectionFactory. This defines the channel, hostname,
port,
queueManager, and transportType properties for a client (TCP/IP) connection to
WMQ
-->
<config-property name="channel" type="java.lang.String">
Channel
</config-property>
<config-property name="hostName" type="java.lang.String">
hostName
</config-property>
<config-property name="port" type="java.lang.String">
40203
</config-property>
<config-property name="queueManager"
type="java.lang.String">
QUEUEMANAGER
</config-property>
<config-property name="transportType"
type="java.lang.String">
CLIENT
</config-property>
<!-- define security domain -->
<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>
Now I deploy the testapplication +wmq.jmsra.ivt.ear+, and the testapplication runs fine,
saying it creates a connection to the destination and sends a test message.
I now try to run my own code, I have refactored it to one short method here to illustrate
how I do it:
private void connectAndSendMessage(String message) throws LoginException, JMSException,
NamingException, CreateException, ConfigurationException, IOException{
InitialContext ctx = new InitialContext();
Queue queue = (Queue) ctx.lookup("IVTQueue");
QueueConnectionFactory qcf = (QueueConnectionFactory)
ctx.lookup("IVTCF");
QueueConnection queueConnection = qcf.createQueueConnection();
queueConnection.start();
QueueSession queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueSender send = null;
try{
send = queueSession.createSender(queue);
TextMessage tm = queueSession.createTextMessage(new
Base64().encode(message));
send.send(tm);
}finally{
if(send!=null){
send.close();
}
}
}
When I try to run it, it manages to get a QueueSession, but when it tries to create a
QueueSender, I get the following exception:
javax.jms.InvalidDestinationException: Not a
JBossDestination:queue://ExampleQueueManager/ExampleQueueName
at org.jboss.jms.client.JBossSession.createProducer(JBossSession.java:206)
at org.jboss.jms.client.JBossSession.createSender(JBossSession.java:406)
at
com.ec.company.util.outbound.OutboundMQBuisnessAction.sendMessageJMS(OutboundMQBuisnessAction.java:81)
at
com.ec.company.util.outbound.OutboundMQBuisnessAction.transferSPSales(OutboundMQBuisnessAction.java:131)
at
com.ec.company.util.outbound.OutboundMQBuisnessAction.execute(OutboundMQBuisnessAction.java:57)
at
com.ec.eccore.controller.ejb.BusinessControllerBean.executeAction(BusinessControllerBean.java:422)
at
com.ec.eccore.controller.ejb.BusinessControllerBean.handleEvent(BusinessControllerBean.java:345)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
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:404)
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:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:960)
at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at
org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy174.handleEvent(Unknown Source)
at
com.ec.frmw.scheduler.job.BusinessControllerInvokerJob.executeBusinessController(BusinessControllerInvokerJob.java:111)
at
com.ec.frmw.scheduler.job.BusinessControllerInvokerJob.execute(BusinessControllerInvokerJob.java:81)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Have anybody seen this before, and can point me in the correct direction?
Regards,
Erik
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/562883#562883]
Start a new discussion in JBoss Messaging at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]