I was trying to implement Windows Service Bus 1.1 with AMQP for my project,
I have installed Windows Service Bus 1.1 and created a Queue with the name test using Service Bus Explorer,
I am testing the sample Service bus functionality with the Java program given in the below link,
https://msdn.microsoft.com/en-us/library/dn574799.aspx
In the example given above link i have removed if else code starting with if(type.compareTo("onprem") == 0) and hard coded my connection string.
And creating the producer as below
Destination que = (Destination) context.lookup("QUEUE"); // reading form properties file
producer = session.createProducer(que);
My connection string and Queue name looks like the below one
connectionstring = amqps://username:pwd#machinename/SampleNameSpace
QueueName = SampleNameSpace/test
When i run the Java program i am getting the ConcurrentTimeOutException when creating the producer.
I am pretty much new to the Service Bus thing and i tried to find out some solution online but it wasn't successful.
Below is my console log
Initial setup
Creating context
Creating connection factory
Creating connection
Creating session
Creating queue
Creating producer
Exception creating producer
javax.jms.JMSException: java.util.concurrent.TimeoutException
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.<init>(MessageProducerImpl.java:98)
at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:390)
at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:59)
at prerna.jms.test.SBTest.main(SBTest.java:71)
Caused by: org.apache.qpid.amqp_1_0.client.Sender$SenderCreationException: java.util.concurrent.TimeoutException
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:178)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:119)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:112)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:98)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:84)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:78)
at org.apache.qpid.amqp_1_0.client.Session$1.<init>(Session.java:90)
at org.apache.qpid.amqp_1_0.client.Session.createSender(Session.java:89)
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.<init>(MessageProducerImpl.java:86)
... 3 more
Caused by: java.util.concurrent.TimeoutException
at org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.waitUntil(ConnectionEndpoint.java:1232)
at org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.waitUntil(ConnectionEndpoint.java:1214)
at org.apache.qpid.amqp_1_0.transport.SessionEndpoint.waitUntil(SessionEndpoint.java:681)
at org.apache.qpid.amqp_1_0.transport.LinkEndpoint.waitUntil(LinkEndpoint.java:355)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:167)
... 11 more
Any help will be greatly appreciated.
You appear to be using the legacy AMQP 1.0 JMS client from the Qpid project which is no longer supported. The first thing I'd suggest is switching to the newer AMQP 1.0 JMS client which you can find on the Qpid site.
Here's a link to the Qpid JMS client examples mirrored on Github, and here's what your maven dep should look like.
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-jms-client</artifactId>
<version>0.23.0</version>
</dependency>
Related
We have an IBM WebSphere AS 9.0.0.7 and when we want to deploy an application containing an MDB - which listens to a remote WebShpere MQ server - while the MQ server is down, then WAS reports an error
Caused by: com.ibm.mq.connector.DetailedResourceAdapterInternalException: MQJCA1011: Failed to allocate a JMS connection., error code: MQJCA1011 An internalerror caused an attempt to allocate a connection to fail. See the linked exception for details of the failure.
and stops the deployment, i.e. application does not start. Which is a big problem as it is a critical hub for other operations. We want to force WAS to start the application and retry the JMS connection later. Is it possible?
You can try setting custom property WAS_EndpointInitialState property to INACTIVE, see here and here, and also may want to look through here.
We've found a solution here: Configuring properties for the IBM MQ resource adapter
Trick was to set startupRetryCount and startupRetryInterval. When the MQ server is not available, the app starts, however it is reported as "Partial start". All other parts of the application seems to be running just fine.
I have Spring Boot application which listen IBM MQ Queue via #JmsListener annotation as below from component class. The MQ properties (hostname, channel, port, etc) are set from yaml file.
#JmsListener(destination = "<QueueName>")
public void receiveMessage(BytesMessage msg) {
//snippet to read msg
}
The MQ dependencies are added in gradle build as below,
compile("com.ibm.mq:mq-jms-spring-boot-starter:0.0.2") {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
This works fine and listening the message as long as I run the application on local with Tomcat container. But if I package this as EAR and deploy to Wesbphere8.5 server, it throws below exception and listener is not reading the message from queue. I confirmed that all the run-time dependencies are packaged in EAR. Tried with different versions of MQ dependencies but no luck.
2018-07-10 15:21:16,531 ERROR DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'QueueName' -
retrying using FixedBackOff{interval=5000, currentAttempts=34,
maxAttempts=unlimited}. Cause: JMSFMQ6312: An exception occurred in
the Java(tm) MQI.; nested exception is com.ibm.mq.jmqi.JmqiException:
CC=2;RC=2195;AMQ9546: Error return code received.
[1=java.lang.reflect.InvocationTargetException[null],3=NativeConstructorAccessorImpl.newInstance0]
Need help to fix this issue.
I faced a similar issue like this. This happens because of missing configurations on IBM MQ Connection with your JMS Application. In My case, I got an authorization related exception but I set the correct user credentials for the IBM mq. when I checked the IBM mq site, the userName is different and that is not which I configured in my spring application.
#IBM MQ JMS Configuration
ibm.mq.queueManager={QUEUE_MANAGER}
ibm.mq.channel={CHANNEL_NAME}
ibm.mq.connName={HOST_NAME(HOST_PORT)}
ibm.mq.user={USER_NAME}
ibm.mq.password={PASSWORD}
Then I added the below property to Use compatibility mode when authenticating with a queue manager.
Here we override the authentication mode. This should not normally be needed with current maintenance levels of MQ V8 or V9, but some earlier levels sometimes got get it wrong and then this flag can be set to "false"
ibm.mq.user-authentication-m-q-c-s-p=false
Please Refer this page for more details
Currently I have setup two queues on WebSphere 7. One for sending and one for recieving messages.
I have configured a activation spec on the receiving queue and the messages are consumed fine by a Message Bean.
Also I have written a client that can run on a separate jvm which can send messages fine to the queue.
I am sure that the queues work.
Now I want to know how can I connect them with WebMetods. I know that WebMethods supports JBoss and WebLogic but no support for WebSphere.
I should be able to get this working just by providing:
a provider url - "iiop://172.17.13.65:2809"
a connection factory - "jms/ConnectionFactroy"
a queue name- "jms/inQueue"
and an initial context - "com.ibm.websphere.naming.WsnInitialContextFactory"
(at least this is what my client is using)
Is there anybody that has resolved this issue? And what are the steps they took?
Thank you in advance for your help.
We were able to get this implementation happen.
To solve this Web Methods had to import some jar files for Client JMS:
com.ibm.ws.ejb.thinclient_7.0.0 + com.ibm.ws.orb_7.0.0 + com.ibm.ws.sib.client.thin.jms_7.0.0
And use a bootstrap of this type PROVIDER_URL: "iiop://natasha:2810"
Alaso these details as previously mentioned:
a factory - "jms/ConnectionFactroy"
a queue name- "jms/inQueue" and
an initial context - "com.ibm.websphere.naming.WsnInitialContextFactory"
I'm testing a WebLogic MDB (running on my local Windows dev environment - Eclipse/WebLogic 10.3.2) with WebSphere MQ 6.0.1.0 (running on a Linux server). The WebSphere MQ components have been previously configured and I have the correct .bindings file.
I have followed the instructions described here.
I have no problem consuming messages that are placed on the MQ queue. However, when I attempt to configure the MDB to put messages back to the MQ queue I get the following warning upon server start-up:
<Warning> <JMSPool> <BEA-169808> <There was an error while making the initial
connection to the JMS resource named jms/WLSenderQCF from the EJB "TestMDB"
inside application "EJB Test 2EAR". The server will attempt the connection
again later. The error was javax.jms.JMSException: MQJMS1068: failed to obtain
XAResource>
If I place a message on the queue, my MDB consumes the messages, but these exceptions are thrown when the MDB attempts to put the message to the MQ Queue:
javax.jms.JMSException: MQJMS1068: failed to obtain XAResource...
javax.transaction.xa.XAException: client connection not XA enabled...
java.lang.NullPointerException
Anyone run into this and knows what the problem is?
Thanks for any help.
One issue seems to be the version of MQ you're using. It is ancient. IBM took MQ 6 out of support quite a while ago (Sept '12! http://www-01.ibm.com/support/docview.wss?uid=swg21584325).
Things got a lot easier when IBM decided to include the extended transactional client in the product for free: http://www-01.ibm.com/support/docview.wss?uid=swg21584325
So one option might be to upgrade to a version which includes this out of the box:
7.0.1.12+
7.1.0.5+
7.5
8.0
Otherwise... look into the v6 documentation on how to enable the 'extended transactional client' for JMS assuming you paid for it.
Hi I am having trouble using the createQueue in JMS. I can create a queue successfully but right after I try to do the following and it fails. Any ideas? Thanks.
QueueSender mySender = mySession.createSender(myQueue);
With the error:
javax.jms.InvalidDestinationException: CWSIA0062E: Failed to create a MessageProducer for queue://Q2?busName=myBus2
at com.ibm.ws.sib.api.jms.impl.JmsMsgProducerImpl.<init>(JmsMsgProducerImpl.java:396)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSenderImpl.<init>(JmsQueueSenderImpl.java:60)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateProducer(JmsQueueSessionImpl.java:224)
at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createProducer(JmsSessionImpl.java:865)
at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:147)
The JMS exception is a multi-level data structure where the lower level is for the JMS transport provider to put vendor-specific errors and the top level is for errors in the JMS API. It is very difficult to tell from the stack trace provided which category this falls into. Note that this is not a WebSphere MQ thing, but rather a JMS thing. As a best practice, always print JMS linked exceptions!
There's a code snippet showing this here:
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/uj24500_.htm
Incidentally, although this is tagged as WebSphere MQ, the stack trace indicates that it is WebSphere App Server's SI Bus classes that are being used as the JMS transport. However, the advice applies to JMS with any transport provider and I'd still recommend printing the linked exception to see what's really going on here.