This troubleshooting guide helps you resolve common problems encountered in JMS integration scenarios with WSO2 ESB.
...
WSO2 ESB comes with geronimo-jms library, which contains the javax.jms packages. Therefore, you do not have to deploy them again.
...
HTTP
...
header conversion
When forwarding HTTP traffic to a JMS queue using WSO2 ESB, you might get an error similar to the one given below.
Code Block |
---|
ERROR JMSSender Error creating a JMS message from the axis message context
javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: Content-Type
|
This exception is specific to the JMS broker used, and is thrown by the JMS client libraries used to connect with the JMS broker.
The incoming HTTP message contains a bunch of HTTP headers that have the ‘-‘ character. Some noticeable examples are Content-length and Transfer-encoding headers. When WSO2 ESB forwards a message over JMS, it sets the headers of the incoming message to the outgoing JMS message as JMS properties. But, according to the JMS specification, the ‘-‘ character is prohibited in JMS property names. Some JMS brokers like ActiveMQ do not check this specifically, in which case there will not be any issues. But some brokers do and they throw exceptions.
...
Code Block | ||
---|---|---|
| ||
<property action="remove" name="Content-Length" scope="transport"> <property action="remove" name="Accept-Encoding" scope="transport"> <property action="remove" name="User-Agent" scope="transport"> <property action="remove" name="Content-Type" scope="transport"> |
...
JMS
...
property data type mismatch
When the ESB attempts to forward a message over JMS, there are instances that the client libraries throw an exception saying the data type of a particular message property is invalid.
This problem occurs when the developer uses the property mediator to manipulate property values set on the message. Certain implementations of JMS have data type restrictions on properties. But the property mediator always sets property values as strings.
...
Code Block | ||
---|---|---|
| ||
<property name="foo" value="12345" type="INTEGER" scope="transport/"> |
...
Too-
...
many-
...
threads and
...
out-of-
...
memory issues
With some JMS brokers, WSO2 ESB tends to spawn new worker threads indefinitely until it runs out of memory and crashes. This problem is caused by a bug in the underlying Axis2 engine. A simple workaround to this problem is to engage the property mediator of the mediation sequence as follows:
...
If your topic or queue name has contains the termination characters ":" or "=", you must escape those characters with a backslash "\" in the jndi.properties
file. Otherwise, JMSUtils will not be able to find the topic/queue and will give you the warning "JMSUtils cannot locate destination". (For more information, see http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load%28java.io.Reader%29.) For example, if the topic name is my::topic
, the following configuration will not work, because the topic name will be parsed as my
instead of my::topic
:
<address uri="jms:/my::topic?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=topic"/>
To avoid this issue, you can create a key-value pair in the jndi.properties
file that maps the topic/queue name to a key that either escapes these characters with a backslash (\) or does not contain ":" or "=". For example:
topic.my\:\:topic = my::topic
or
topic.myTopic = my::topic
You can then use this key in the proxy service as follows:
<address uri="jms:/my\:\:topic?transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=topic"/>
If you do not want to use the JNDI properties file, you can define the key-value pair right in the proxy configuration:
<address uri="jms:/my\:\:topic?transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&topic.my\:\:topic=my::topic&java.naming.provider.url=repository/conf/jndi.properties&transport.jms.DestinationType=topic"/>