WS02 JMS transport for Websphere MQ - jms

After looking for a couple of days I have the problem to consume message from IBM MQ. I followed the documentation, but still, the system is not working fine. I'm using 4.8.0 and MQ 7.5.0.2
error
[2014-02-06 01:06:14,341] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.
[2014-02-06 01:06:14,342] ERROR - JMSListener Connection attempt : 1 for JMS Provider failed. Next retry in 20 seconds
[2014-02-06 01:06:34,364] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.
[2014-02-06 01:06:34,365] ERROR - JMSListener Connection attempt : 2 for JMS Provider failed. Next retry in 40 seconds
root#sandbox:/opt/wso2esb-4.8.0/FFDC# more JMSCC0001.FDC
----------------------------------START FFST------------------------------------
/opt/wso2esb-4.8.0/FFDC/JMSCC0001.FDC PID:5897
JMS Common Client First Failure Symptom Report
Product :- IBM WebSphere MQ classes for JMS
Date/Time :- Thu Feb 06 00:54:07 CET 2014
System time :- 1391644447539
Operating System :- SunOS
UserID :- root
Java Vendor :- Oracle Corporation
Java Version :- 23.3-b01
Source Class :- com.ibm.mq.jms.MQQueueConnectionFactory
Source Method :- readObject()
ProbeID :- XF001003
Thread :- name=localhost-startStop-1 priority=5 group=main ccl=org.eclipse.core.runtime.internal.adaptor.ContextFinder#1da36ad
axis2 config
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">file:///var/tmp/jndi</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="transport.jms.Destination" locked="false">ivtQ</parameter>
</parameter>
</transportReceiver>
test jndi is working
java JmsJndiConsumer -i file:///var/tmp/jndi -c ivtQCF -d ivtQ
Initial context found!
Received message:
JMSMessage class: jms_text
JMSType: null
JMSDeliveryMode: 2
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: ID:414d5120514d412020202020202020204424ee5203db0020
JMSTimestamp: 1391646438379
JMSCorrelationID: null
JMSDestination: queue://QMA/QUEUE1
JMSReplyTo: null
JMSRedelivered: false
JMSXAppID: JmsJndiProducer
JMSXDeliveryCount: 1
JMSXUserID: webservd
JMS_IBM_Character_Set: UTF-8
JMS_IBM_Encoding: 273
JMS_IBM_Format: MQSTR
JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 28
JMS_IBM_PutDate: 20140206
JMS_IBM_PutTime: 00271840
JmsJndiProducer: Your lucky number today is 324
proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy2"
transports="jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<inSequence>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
I've check the network and i cannot see any connecton form esb to mq server.
Any idea ?
update
I have configured the axis server in the sample ($WSO2_HOME/samples/axis2Server/repository/conf/axis2.xml) with exactly the same jms transport (default).
Atfer compiling the 'SimpleStockQuoteService' and starting the the server i can see that is working fine.
cd wso2esb-4.8.1/samples/axis2Server/src/SimpleStockQuoteService/ && ant
cd wso2esb-4.8.1/samples/axis2Server/ && ./axis2server.sh
14/02/10 21:20:29 INFO jms.JMSListener: JMS listener started
14/02/10 21:20:30 INFO jms.JMSListener: Connection attempt: 1 for JMS Provider for
service: SimpleStockQuoteService was successful!
14/02/10 21:20:30 INFO jms.ServiceTaskManager: Task manager for service :
SimpleStockQuoteService [re-]initialized
14/02/10 21:20:31 INFO jms.JMSListener: Started to listen on destination : ivtQ of
type queue for service SimpleStockQuoteService
14/02/10 21:20:31 INFO util.SampleAxis2ServerManager: [SimpleAxisServer] Started
I still not understand why is not working inside carbon !!!

The only way I found to made it work is to modify the startup script (ws02server.sh) to add the MQ client java library to the classpath
CARBON_CLASSPATH=/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:"$CARBON_CLASSPATH"
If MQ transport type is BIND (ws02 on the same server as the MQ server) the JNI library need also to be included (-Djava.library.path=/opt/mqm/java/lib)
Copying the MQ java library to the repository/component/lib as stated in the documentation is not working.
Tested with MQ 7.5.0.2 and ws02 4.8.1 on Solaris and RHEL7

Related

javax.naming.NameNotFoundException for migrating from IBM Mq to tomcat

I am receiving below exception while trying to connect JMS MQ using tomcat. We are migrating from WebSphere to Tomcat.So currently I am using IBM MQ jars
2018-11-21 12:26:53,862 DEBUG com.mbfs.slr.bo.pe.JMSClient.sendMsg:283 - Exception occured : null
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:384 - Trying to receive message ...
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:385 - getJndiConnectionFactory : jms/Name of Queue
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:386 - getRecieveJndiQueueName : jms/name of receiving queue
2018-11-21 12:26:53,864 DEBUG com.mbfs.slr.bo.pe.JMSClient.createQueue:221 - Created JNDI intial Context ...
2018-11-21 12:26:53,864 DEBUG com.mbfs.slr.bo.pe.JMSClient.createQueue:239 - JNDI API lookup failed: javax.naming.NameNotFoundException: Name [jms/NAmeofQueue] is not bound in this Context. Unable to find [jms].
I have placed all IBM MQ jars.I have placed entry in TomEE server.xml and web.xml.
Please let me know if I am missing any configuration
I have placed following entry in
Server.xml
<Resource name="jms/XXXBQueueConnectionFactory" auth="Container" type="com.ibm.mq.jms.MQQueueConnectionFactory" factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory" description="JMS Queue Connection Factory" HOST="XXXX" PORT="XX5" CHAN="XXX" TRAN="1" QMGR="XXX" />

WSO2 VFS FTP Proxy does not read parameters

I have written a proxy service and deployed on WSO2 ESB 5 to receive some file content via http and use vfs transport to transfer that content to an ftp server. The service works as expected when I specify the connection parameters correctly but when I specify something wrong on the connection string to simulate a down server, I can not manage to control the behavior of the VFS transport using the parameters specified in [1]. What I'm looking for is to short the delay between the error occurred in VFS and the fault exception catched by Axis;
As you are going to see below I specify 0 retries and 0 wait time between retries but it seems the VFSTransportSender class is not able to read somehow those values because it does all the time the same number of retries and it waits the same number of seconds each time it is executed, I also changed the values and put others but the result is always the same, the server is always retrying 3 more times with 30 seconds delay between each other besides the original request before Axis is able to receive some information related to the error.
Here is my proxy service that works without any issues:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ftpProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="https,http">
<target>
<inSequence>
<log level="full"/>
<property expression="json-eval($.key)" name="file_name"/>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
<property name="HTTP_SC" scope="axis2" value="200"/>
<property expression="fn:concat(get-property('file_name'), '.json')"
name="transport.vfs.ReplyFileName"
scope="transport"/>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<endpoint name="ftp_endpoint">
<address uri="vfs:ftp://jairof_ftp:passftp#localhost:21">
<timeout>
<duration>2000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
</target>
<parameter name="transport.vfs.ReconnectTimeout">0</parameter>
<parameter name="transport.vfs.MaxRetryCount">0</parameter>
<description/>
</proxy>
And when I want to simulate the server is not reachable I just modify the address URI and I put this one where the user is incorrect:
<address uri="vfs:ftp://ja8irof_ftp:passftp#localhost:21">
I have also tried to set the transport.vfs parameters as properties before calling the endpoint but the result is exactly the same
Here you can inspect part of the log file where I cut some parts of the stack trace to keep the post simple:
[2016-10-29 12:23:01,134] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:23:34,223] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,842] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,844] ERROR - VFSTransportSender cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,846] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:275)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.createClient(FTPClientWrapper.java:100)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.getFtpClient(FTPClientWrapper.java:134)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.<init>(FTPClientWrapper.java:59)
at org.apache.commons.vfs2.provider.ftp.FtpFileProvider.doCreateFileSystem(FtpFileProvider.java:128)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:155)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:119)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:88)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:738)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:626)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:233)
... 19 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
Please send me any comments, suggestions... I would appreciate so much, thanks in advance for your time.
[1] https://docs.wso2.com/display/ESB500/VFS+Transport
Try appending parameters to the endpoint URL, like this.
<address uri="vfs:ftp://ja8irof_ftp:passftp#localhost:21?transport.vfs.MaxRetryCount=0&transport.vfs.ReconnectTimeout=0"/>

Wildfly 10 for jms messaging

I tried a simple spring jms example and deployed in tomee worked fine (din't start activemq server). Then I migrated to wildfly 10. But here i need to start activemq server. Is it needed wildfly is already integrated with activemq right? On starting the server (standalone.bat) should start the activemq isn't?
EDIT: Actually some configuration has been changed (I was not aware of the change). I unzipped wildfly 10 again and tried to deploy using "standalone.bat -c standalone-full.xml". Server started successfully but got the below given error.
10:29:26,172 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 13367ms - Started 401 of 691 services (397 services are lazy, passive or on-demand)
10:29:29,101 INFO [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) JMS message listener invoker needs to establish shared Connection
10:29:30,111 ERROR [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Could not refresh JMS Connection for destination 'myMessageQueue' - retrying in 5000 ms. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
I managed to fix this problem by adding an embedded broker to my springcontext.xml
<amq:broker id="broker" useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61617" />
</amq:transportConnectors>
</amq:broker>
Refered : http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html

SocketException Broken pipe receives when the server is under load (Spring AMQP)

We are using Spring AMQP 2.8 with RabbitMQ 2.8.7 version. We are building our connection factory as below.
<!-- RabbitMQ Local connectivity -->
<rabbit:connection-factory
id="localWhispirConnectionFactory"
addresses="${system.local.rabbitmq.host}"
username="${system.local.rabbitmq.username}"
password="${system.local.rabbitmq.password}"
connection-factory="rabbitWhispirLocalFactory"/>
<!-- Heartbeat configuration every 10sec -->
<bean id="rabbitWhispirLocalFactory" class="com.rabbitmq.client.ConnectionFactory">
<property name="requestedHeartbeat" value="10" />
</bean>
But when the server is under load, we received the below exceptions. Tries several ways, but appreciate any comments to overcome this issue.
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-wfazQuIuS-BM-CosxP_2GJ], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir#10.50.50.128:5672/,62), acknowledgeMode=AUTO local queue size=0
2015-04-20 12:01:00,156 WARN [SimpleMessageListenerContainer] Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: java.net.SocketException: Broken pipe
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-AjjxOJ2doe4yi2GtTHKumM], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir#10.50.50.128:5672/,29), acknowledgeMode=AUTO local queue size=0
Thanks.
There is no such version (2.8) of Spring AMQP. Currently, the latest version is 1.4.4.
Check the server logs to see if there are any clues there.
That said, 2.8.7 is a very old broker; I am quite sure the rabbitmq guys would recommend upgrading to a more recent version, currently the latest is 3.5.1.

Active MQ clustering using http auto discovery with multi cast on Amazon EC2

We are trying to set up the active MQ cluster on production environment on Amazon EC2 with Auto discover and multicast.
I was able to configure successfully auto discovery with multi-cast on my local active mq server but on Amazon EC2 it is not working.
From the link
I found that Amazon EC2 does not support multi-cast. Hence we have to use HTTP transport or VPN for multi-cast. I tried HTTP transport for multi-cast by downloading activemq-optional-5.6.jar (we are using Active-MQ 5.6 version). It requires httpcore and httpClient jars to servlet in it class path.
In broker configuration(activemq.xml)
`
&ltnetworkConnectors>
&ltnetworkConnector name="default" uri="http://localhost:8161/activemq/DiscoveryRegistryServlet"/>
&lt/networkConnectors>
&lttransportConnectors>
&lttransportConnector name="activemq" uri="tcp://localhost:61616" discoveryUri="http://localhost:8161/activemq/DiscoveryRegistryServlet"/>
&lt/transportConnectors>`
are added.
But broker is not identifying the DiscoveryRegistryServlet.
Any help is much appreciated.
Finally figured out how to setup active MQ auto discovery with HTTP
Active-MQ Broker configuration:
In $ACTIVEMQ_HOME/webapps folder create a new folder
|_activemq
|_WEB-INF
|_classes
|_web.xml
create a web.xml file with the following contents
&ltweb-app>
&ltdisplay-name>ActiveMQ Message Broker Web Application&lt/display-name>
&ltdescription>
Provides an embedded ActiveMQ Message Broker embedded inside a web application
&lt/description>
&lt!-- context config -->
&ltcontext-param>
&ltparam-name>org.apache.activemq.brokerURL&lt/param-name>
&ltparam-value>tcp://localhost:61617&lt/param-value>
&ltdescription>The URL that the embedded broker should listen on in addition to HTTP&lt/description>
&lt/context-param>
&lt!-- servlet mappings -->
&ltservlet>
&ltservlet-name>DiscoveryRegistryServlet&lt/servlet-name>
&ltservlet-class>org.apache.activemq.transport.discovery.http.DiscoveryRegistryServlet&lt/servlet-class>
&ltload-on-startup>1&lt/load-on-startup>
&lt/servlet>
&ltservlet-mapping>
&ltservlet-name>DiscoveryRegistryServlet&lt/servlet-name>
&lturl-pattern>/*&lt/url-pattern>
&lt/servlet-mapping>
&lt/web-app>
Place httpclient-4.0.3.jar, httpcore-4.3.jar, xstream-1.4.5.jar and activemq-optional-5.6.0.jar in $ACTIVEMQ_HOME/lib directory.
In $ACTIVEMQ_HOME/config directory, modify the jetty.xml file to expose activemq web app.
&ltbean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
...
&ltproperty name="handler">
&ltbean id="sec" class="org.eclipse.jetty.server.handler.HandlerCollection">
&ltproperty name="handlers">
...
...
&ltbean class="org.eclipse.jetty.webapp.WebAppContext">
&ltproperty name="contextPath" value="/activemq" />
&ltproperty name="resourceBase" value="${activemq.home}/webapps/activemq" />
&ltproperty name="logUrlOnStart" value="true" />
&ltproperty name="parentLoaderPriority" value="true" />
...
...
&lt/list>
&lt/property>
&lt/bean>
&lt/property>
&lt/bean>
Modify activemq.xml file in $ACTIVEMQ_HOME/conf directory to use http protocol
&ltbroker name=”brokerName”>
...
&ltnetworkConnectors>
&ltnetworkConnector name="default" uri="http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/DiscoveryRegistryServlet?group=test"/>
&lt!--&ltnetworkConnector name="default-nc" uri="multicast://default"/>-->
&lt/networkConnectors>
&lttransportConnectors>
&lttransportConnector name="http" uri="tcp://0.0.0.0:61618" discoveryUri="http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/test"/>
&lt/transportConnectors>
...
&lt/broker>
make sure that the broker names are unique. “test” in url is the group name of brokers.
Client configuration:
1. Keep httpclient-4.0.3.jar, httpcore-4.3.jar, xstream-1.4.5.jar and activemq-optional-5.6.0.jar in classpath of client
2. URL to be use by client
discovery:(http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/test)connectionTimeout=10000
here “test” is the group name.

Resources