mzwebstudio mzwebstudio - 1 year ago 89
Android Question

Kaazing JMS Client Fails to connect

I'm able to connect my hybrid android app with Kaazing using the following lines:

var jmsConnectionFactory;
jmsConnectionFactory = new JmsConnectionFactory("ws://");
var connectionFuture = jmsConnectionFactory.createConnection(null, null, function () {/*something is done here*/}

lines of the gateway-config.xml are:

<name>JMS Service</name>
<description>JMS Service</description>



This is the error

ConnectionFailedException : WebSocket connection failed"

The worst part is that it was working fine, and I was able to connect but now it is not working.

What I did was upgraded my nodejs installed cordova to upgrade it. Now I have brought back every thing but it doesn't work.

Answer Source

In what I say below, KAAZING_GATEWAY_HOME represents the directory in which you installed the Kaazing JMS Gateway.

There are several moving parts - the client, the Kaazing JMS Gateway, and the EMS back-end. The problem could be the Kaazing JMS Gateway connecting to EMS on the back end, or there could be an issue with the client trying to connect to the Kaazing JMS Gateway. There is not much detail yet. In order for us to troubleshoot, one way to provide more detail is to make the logging on the Kaazing JMS Gateway more verbose.

The log is by default written to KAAZING_GATEWAY_HOME/log/. There are several there but the main log is error.log. Its default LOG4J configuration is in KAAZING_GATEWAY_HOME/conf/log4j-config.xml. You can get more diagnostics for the connection issues on both ends by replacing the contents of that file with the following (you can make a backup copy to restore the default log configuration later):

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

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="">
    <appender name="ErrorFile" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="${GATEWAY_LOG_DIRECTORY}/error.log"/>
        <param name="Append" value="false"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %m%n"/>

    <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %m%n"/>

    <logger name="transport">
        <level value="trace"/>

    <logger name="com.kaazing.gateway.jms">
        <level value="trace"/>

    <logger name= "service.stomp.jms">
        <level value="trace"/>

    <logger name= "service.jms">
        <level value="trace"/>

        <priority value="info"/>
        <appender-ref ref="ErrorFile"/>
        <appender-ref ref="STDOUT"/>


Once you have copied that in place, try connecting again. If you see no logging in the gateway for the connection attempts from your client, it means there is an issue in the client code or configuration, between the client and the gateway, or on the client machine itself. Otherwise, please share the results of updating this. The results should be time-stamped so you can tell which log entries correspond to your attempts to connect.

You can share your logs here, or directly to me at the address below.

Please keep us posted. Best regards, Dan Smith, Kaazing Global Support