MQTT + Eclipse Paho + Java 8 + compiler with line command

868 views
Skip to first unread message

neuber jose sousa

unread,
Sep 3, 2014, 9:32:34 PM9/3/14
to mq...@googlegroups.com

I'm trying to run this project

I have this error: http://pic.twitter.com/rTjrPKK6hm -and- this error: http://pic.twitter.com/lqcx0Urdjc

Thsi is my paste of the raspberry pi:

    root@raspberrypi:/opt# ls
jdk1.8.0_06  MQTTBaseClass.java     pi4j      vc
jdk8         mqtt-client-0.4.0.jar  sonic-pi  Wolfram

When I tried this command:

    javac -cp mqtt-client-0.4.0.jar MQTTBaseClass.java

I have this errors:

    root@raspberrypi:/opt# javac -cp mqtt-client-0.4.0.jar MQTTBaseClass.java
MQTTBaseClass.java:11: error: cannot find symbol
import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence;
                                              ^
  symbol:   class MemoryPersistence
  location: package org.eclipse.paho.client.mqttv3.internal
MQTTBaseClass.java:13: error: package com.pi4j.io.gpio does not exist
import com.pi4j.io.gpio.GpioController;
                       ^
MQTTBaseClass.java:14: error: package com.pi4j.io.gpio does not exist
import com.pi4j.io.gpio.GpioFactory;
                       ^
MQTTBaseClass.java:15: error: package com.pi4j.io.gpio does not exist
import com.pi4j.io.gpio.GpioPinDigitalOutput;
                       ^
MQTTBaseClass.java:16: error: package com.pi4j.io.gpio does not exist
import com.pi4j.io.gpio.RaspiPin;
                       ^
MQTTBaseClass.java:25: error: cannot find symbol
    private static GpioPinDigitalOutput pin;
                   ^
  symbol:   class GpioPinDigitalOutput
  location: class MQTTBaseClass
MQTTBaseClass.java:26: error: cannot find symbol
    private static GpioController gpio;
                   ^
  symbol:   class GpioController
  location: class MQTTBaseClass
MQTTBaseClass.java:34: error: cannot find symbol
            gpio = GpioFactory.getInstance();
                   ^
  symbol:   variable GpioFactory
  location: class MQTTBaseClass
MQTTBaseClass.java:36: error: cannot find symbol
                    "eorasppi", new MemoryPersistence());
symbol:   class MemoryPersistence
  location: class MQTTBaseClass
MQTTBaseClass.java:41: error: <anonymous MQTTBaseClass$1> is not abstract and does not override abstract method deliveryComplete(IMqttDeliveryToken) in MqttCallback
            client.setCallback(new MqttCallback() {
                                                  ^
MQTTBaseClass.java:43: error: method does not override or implement a method from a supertype
                @Override
                ^
MQTTBaseClass.java:78: error: method does not override or implement a method from a supertype
                @Override
                ^
MQTTBaseClass.java:95: error: cannot find symbol
                    RaspiPin.GPIO_01, "MyLED");
                    ^
  symbol:   variable RaspiPin
  location: class MQTTBaseClass
13 errors

neuber jose sousa

unread,
Sep 4, 2014, 1:58:33 PM9/4/14
to mq...@googlegroups.com
Now, this is my paste:

root@neuber-HP-EliteBook-8460p:/opt# ls
eclipse google jdk MQTTBaseClass.java mqtt-client-0.4.0.jar org.eclipse.paho.client.mqttv3-1.0.0.jar pi4j
and, this is errors:

root@neuber-HP-EliteBook-8460p:/opt# javac -cp mqtt-client-0.4.0.jar:/opt/pi4j/lib/'*' MQTTBaseClass.java


MQTTBaseClass.java:11: error: cannot find symbol
import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence;
^
symbol: class MemoryPersistence
location: package org.eclipse.paho.client.mqttv3.internal

MQTTBaseClass.java:36: error: cannot find symbol
"eorasppi", new MemoryPersistence());

^
symbol: class MemoryPersistence


location: class MQTTBaseClass
MQTTBaseClass.java:41: error: <anonymous MQTTBaseClass$1> is not abstract and does not override abstract method deliveryComplete(IMqttDeliveryToken) in MqttCallback
client.setCallback(new MqttCallback() {
^
MQTTBaseClass.java:43: error: method does not override or implement a method from a supertype
@Override
^
MQTTBaseClass.java:78: error: method does not override or implement a method from a supertype
@Override
^

5 errors

neuber jose sousa

unread,
Sep 4, 2014, 7:45:48 PM9/4/14
to mq...@googlegroups.com
Now, this is my paste:

root@neuber-HP-EliteBook-8460p:/opt# ls
eclipse google jdk MQTTBaseClass.java mqtt-client-0.4.0.jar org.eclipse.paho.client.mqttv3-1.0.0.jar pi4j
and, this is errors:

root@neuber-HP-EliteBook-8460p:/opt# javac -cp mqtt-client-0.4.0.jar:/opt/pi4j/lib/'*' MQTTBaseClass.java


MQTTBaseClass.java:11: error: cannot find symbol
import org.eclipse.paho.client.mqttv3.internal.MemoryPersistence;
^
symbol: class MemoryPersistence
location: package org.eclipse.paho.client.mqttv3.internal

MQTTBaseClass.java:36: error: cannot find symbol
"eorasppi", new MemoryPersistence());

^
symbol: class MemoryPersistence


location: class MQTTBaseClass
MQTTBaseClass.java:41: error: <anonymous MQTTBaseClass$1> is not abstract and does not override abstract method deliveryComplete(IMqttDeliveryToken) in MqttCallback
client.setCallback(new MqttCallback() {
^
MQTTBaseClass.java:43: error: method does not override or implement a method from a supertype
@Override
^
MQTTBaseClass.java:78: error: method does not override or implement a method from a supertype
@Override
^

5 errors

Andy Piper

unread,
Sep 7, 2014, 6:43:53 PM9/7/14
to mq...@googlegroups.com
The MQTT Google Group is intended for general protocol discussions rather than anything implementation-specific, and you're asking about Eclipse Paho which has its own mailing list.

Saying that, you've also been spamming many people on Twitter, and asked on Stack Overflow. I'm afraid that you are just annoying people by repeatedly asking people to solve your problem like this - several people have already tried to help you. I've muted your mentions on Twitter as I simply cannot drop everything mid-meeting or while I'm on a train, to respond to your "urgent" demands for me to fix someone else's code.

The code you are trying to get to work is about 2 years old and the original author isn't responding to requests for support. I cannot vouch for it.

I am not sure you are very experienced in Java code and I believe you are having significant difficulty here. I've explained these steps to you on Twitter already, but you're posting screenshots which are not very helpful, and I don't think you've followed the instructions I've provided. We are all busy and these are Open Source communities where we can offer pointers, but we cannot always do absolutely every single thing for you, so you need to make an effort to learn and understand where you can.

You're missing a bunch of pi4j (not relevant to MQTT) classes provided by a third party project. You will need to deal with that yourself.

For MQTT, first of all you need to get the latest Paho code (1.0 is the release version; you can also use Gradle to get 1.0.1-SNAPSHOT from Eclipse's repository).

You then need to use the MemoryPersistence class like this:

import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;

You will then hit another error about IMqttDeliveryToken which needs to be explicitly imported, with the relevant methods implemented in the MQTTBase class. You'll also need to fix the MessageArrived method to deal with the fact that topics are now just Strings. The broker that the code is configured to use by default is m2m.eclipse.org, this should now be iot.eclipse.org.

The Android piece of the code is likely to require much more patching as Android has changed a lot in the past 2 years and the base / target deployment version will be different.

Good luck. Perhaps when you have a working set of projects, you can blog about what you did and what you learned, and share your new code on Github to help others.



5 errors

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at http://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/d/optout.



--
Andy Piper | Kingston upon Thames, London (UK)
blog: http://andypiper.co.uk   |   skype: andypiperuk
twitter: @andypiper  |  images: http://www.flickr.com/photos/andypiper

neuber jose sousa

unread,
Sep 8, 2014, 1:53:40 PM9/8/14
to mq...@googlegroups.com
I'm not use android studio 0.8 for this project. I'm using eclipse kepler.

Now, when I try compiler the java project with eclipse kepler, I has this error: "Selection does not contaim a main type"

Nicholas O'Leary

unread,
Sep 8, 2014, 5:36:22 PM9/8/14
to mq...@googlegroups.com
Hi, 

as Andy said, this mailing list is about the protocol in general, not any particular implementation. Given the lack of response you've had, I'm not sure you'll get much else here.

Have you tried contacting the original author of the project on github, or raising an issue against it for support?

Nick

--

neuber jose sousa

unread,
Sep 8, 2014, 10:25:33 PM9/8/14
to mq...@googlegroups.com
Now I have this errors on the eclipse kepler with java 8:

Description    Resource    Path    Location    Type
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 6    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 5    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 4    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 3    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 10    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 9    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 8    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 7    Java Problem
MemoryPersistence cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 36    Java Problem
MqttClient cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 35    Java Problem
MqttClient cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 35    Java Problem
The import org.eclipse cannot be resolved    MQTTBaseClass.java    /MyMQTT2/src    line 11    Java Problem
Syntax error, annotations are only available if source level is 1.5 or greater    MQTTBaseClass.java    /MyMQTT2/src    line 43    Java Problem
MqttCallback cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 41    Java Problem
MqttConnectOptions cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 37    Java Problem
MqttConnectOptions cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 37    Java Problem
Syntax error, annotations are only available if source level is 1.5 or greater    MQTTBaseClass.java    /MyMQTT2/src    line 65    Java Problem
Syntax error, annotations are only available if source level is 1.5 or greater    MQTTBaseClass.java    /MyMQTT2/src    line 55    Java Problem
MqttMessage cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 44    Java Problem
MqttTopic cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 44    Java Problem
MqttMessage cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 90    Java Problem
Syntax error, annotations are only available if source level is 1.5 or greater    MQTTBaseClass.java    /MyMQTT2/src    line 84    Java Problem
MqttDeliveryToken cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 79    Java Problem
Syntax error, annotations are only available if source level is 1.5 or greater    MQTTBaseClass.java    /MyMQTT2/src    line 78    Java Problem
MqttException cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 107    Java Problem
MqttPersistenceException cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 104    Java Problem
MqttTopic cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 97    Java Problem
MqttMessage cannot be resolved to a type    MQTTBaseClass.java    /MyMQTT2/src    line 90    Java Problem



Em quarta-feira, 3 de setembro de 2014 22h32min34s UTC-3, neuber jose sousa escreveu:

neuber jose sousa

unread,
Sep 8, 2014, 10:27:05 PM9/8/14
to mq...@googlegroups.com
Nick,,

The original author, unresponsive emails, google+, hangouts, twitter


Em quarta-feira, 3 de setembro de 2014 22h32min34s UTC-3, neuber jose sousa escreveu:

neuber jose sousa

unread,
Sep 9, 2014, 2:43:20 PM9/9/14
to mq...@googlegroups.com
Now I have 4 errors when compiler MyMQTT (MQTTBaseClass.java)


Description    Resource    Path    Location    Type
The method messageArrived(MqttTopic, MqttMessage) of type new MqttCallback(){} must override or implement a supertype method    MQTTBaseClass.java    /MyMQTT/src    line 44    Java Problem
The method deliveryComplete(MqttDeliveryToken) of type new MqttCallback(){} must override or implement a supertype method    MQTTBaseClass.java    /MyMQTT/src    line 79    Java Problem
The type new MqttCallback(){} must implement the inherited abstract method MqttCallback.messageArrived(String, MqttMessage)    MQTTBaseClass.java    /MyMQTT/src    line 41    Java Problem
The type new MqttCallback(){} must implement the inherited abstract method MqttCallback.deliveryComplete(IMqttDeliveryToken)    MQTTBaseClass.java    /MyMQTT/src    line 41    Java Problem

Nicholas O'Leary

unread,
Sep 9, 2014, 4:39:06 PM9/9/14
to mq...@googlegroups.com
Hi,

there is no-one on this mailing list that is familiar with the project you are trying to compile. As has been pointed out a few times, this mailing list is about the MQTT protocol, not particular implementations, nor for debugging old abandoned code bases that don't work.

I suggest you start with a more simple example use of the current paho client. Once you are comfortable with using it, you can then work out what changes are necessary in the project to use the current API.

I hope you manage to figure it out, but please don't use this mailing list to do it.

Nick

--

Andy Piper

unread,
Sep 9, 2014, 6:24:31 PM9/9/14
to mq...@googlegroups.com

Totally agree with Nick. Go back to basics.

I actually have told you how to fix this specific problem (use latest jar for 1.0 + and and then modify messageArrived to match the method signature) but you're showing no signs of understanding what several of us have told you.

I've now not only muted you on Twitter, I've blocked you as I don't need the constant demands for attention and support and I am not your personal one man support agent - nor are any of the open source contributors who have tried to help you.a Any tweets you direct at me will be ignored.

Ask in the right places, be prepared to do some work yourself, and listen to what you've been advised. Like I said before, then share what you learned with the rest of the community.

Message has been deleted

neuber jose sousa

unread,
Sep 12, 2014, 10:57:02 AM9/12/14
to mq...@googlegroups.com

Roger Light

unread,
Sep 12, 2014, 11:07:09 AM9/12/14
to mq...@googlegroups.com
On Fri, Sep 12, 2014 at 3:57 PM, neuber jose sousa <neube...@gmail.com> wrote:

> https://github.com/neuberfran/mqtt/blob/master/MQTTBaseClass.java

Please, you've been asked to stop posting about this problem to this
mailing list. It is not a Java support list.

Furthermore, I'm disappointed that you haven't taken on board another
important point that Andy and Nick have made, which is around the
attitude of demanding help without making any effort yourself. Sending
a link to a file without any other text could be considered a mistake,
but to do it two days on the trot makes me think you expect us to
critique/fix the code. Do you see that this isn't a polite way of
approaching things?

I wouldn't be surprised if the people in control of the mailing list
remove you from the list if you keep on posting like this, so please
go do some work yourself first and only then if you still have
problems go find a more appropriate support channel.

Regards,

Roger

Nicholas O'Leary

unread,
Sep 12, 2014, 11:19:04 AM9/12/14
to mq...@googlegroups.com
Hi,

as Roger says this is not a support list for your code and you have ignored our attempts to help.

Any future email from you will now be held in moderation and must be approved before it will appear on the list.

If you show a more constructive approach we won't be forced to block you entirely.

Nick

Reply all
Reply to author
Forward
0 new messages