14.2s Java Issue

I am deploying an app using javaetk_1.4.4. The application deploys and works fine using firmware version 13.3s0. When I deploy it to a device running 14.2s0 it deploys the code and says its starting but the device reboots itself. Is there a problem deploying java apps to version 14.2s0? Is there a way to debug whats making the device reboot?

Thanks

Rich

I don’t know of any issues with java apps in FW14.2. Do you see any errors in the event logs? Does it give you a reboot reason?

Is this a program you could share with us so we can test it?

Deryck

ReadingTagsV2.zip (19.6 KB)

I uploaded the file. I looked at the event log reason was power loss.

Hello,
I was was seeing the same issue when running it in FW 14.3. Can you add a 1 second sleep after calling mqtt connect in MqttToC8Y.java. Changing this allowed us to get it working.

Mqtt_c.connect();
Thread.sleep(1000);
MqttMessage createDevice = new MqttMessage("s/us", ("100," + mqttexternalId + ",conveyor"));

Deryck

Sure I can do that. I will give you an update by tomorrow.

Hi @wagnerr13,

Deryck is out on vacation right now but I wanted to check if there was any update on this?

Best Regards,
-Tim

Sorry that I forgot to respond. This fixed my issue.

Thanks

Rich

Thanks for the update Rich,

I’ll close the case out for Deryck then

Happy Holidays,
-Tim

1 Like

Hello @wagnerr13,

Reviewing with another colleague it looks like this could be related to how an MQTT call back is fired when a message is received.

Rather then doing the following as shows in some old examples.

public void callMqttEvent(int event) {
        // When a message is received through a subscribed topic,
        // the function callMqttEvent is called
        try {
            MqttMessage msg;
            msg = readMessage();
            if (msg != null) {
                String str = new String(msg.getPayload(), "UTF-8");
                System.out.println("MQTT Message Received: " + str);
                }
        } catch (Exception e) {
            System.out.println("Error callMqttEvent: " + e.toString());
        }
    }

You would want to do the following:

 public void callMqttEvent(int event) {
            // When a message is received through a subscribed topic,
            // the function callMqttEvent is called
            try {
                if (event == 1) {
                    // MQTT connection event
                    
                } else {
                    // Incoming MQTT messageShareTagsOverTalk2M
                    MqttMessage msg;
     
                    msg = readMessage();
                    if (msg != null) {
                        String Message = new String(msg.getPayload(), "UTF-8");
                        Log.addLog("Incoming message : " + Message, Log.info);
                        msg.close();
                    }
                }
            } catch (Exception e) {
                Log.addLog("Error callMqttEvent: " + e.toString(), Log.error);
            }
        }
}

Here, we check if it is a Connection up/down event or an incoming message event before reading the message.