Home » Eclipse Projects » Kura » Errors starting kura with greenhouse example
Errors starting kura with greenhouse example [message #1698349] |
Sun, 14 June 2015 18:53 |
Diego Alejandro Palmeira Messages: 8 Registered: June 2015 |
Junior Member |
|
|
Hi guys,
I'm trying to get work with http://iot.eclipse.org/java/tutorial/ example, but I have some errors and it doesn't works for me.
I'm using Raspberry PI B+ with JDK8 preinstalled.
Basically if I set "javaonedemo/device1" in Kura, I get an error in the kura log file:
"Invalid usage of multi-level wildcard in topic string: javaonedemo/device1#", and if I replace it with a "/" at the end... "javaonedemo/device1/" it seems to work, and kura don't complain in the startup process.
After this little change if I try http://iot.eclipse.org/java/demo/app/#/greenhouses/remote/device1
Nothing happened in the showed page.
So I decided to test it using my local Mosquitto server...
But, I get a new error when I'm trying to send a message to turn "on" the light, for example: mosquitto_pub -t "javaonedemo/device1/actuators/light" -m "on" -q 0 -r
Kura log says (in debug mode):
2015-06-14 11:19:15,361 [MQTT Call: 40:A5:EF:03:2B:8A] ERROR o.e.k.c.d.DataServiceListeners - Unexpected Throwable
java.lang.NullPointerException
at org.eclipse.iot.greenhouse.sensors.raspberrypi.Pi4JGreenhouseSensorService.setActuatorValue(Pi4JGreenhouseSensorService.java:154)
at org.eclipse.iot.greenhouse.publisher.GreenhousePublisher.onMessageArrived(GreenhousePublisher.java:149)
...
2015-06-14 11:19:15,366 [MQTT Call: 40:A5:EF:03:2B:8A] DEBUG o.e.k.c.c.CloudServiceImpl - Message arrived on topic: javaonedemo/device1/actuators/light
2015-06-14 11:19:15,371 [MQTT Call: 40:A5:EF:03:2B:8A] ERROR o.e.k.c.d.DataServiceListeners - Unexpected Throwable
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.kura.core.message.protobuf.KuraPayloadProto
at org.eclipse.kura.core.message.protobuf.KuraPayloadProto$KuraPayload.getDescriptor(KuraPayloadProto.java:69)
...
If you see the code there, it is: (Pi4JGreenhouseSensorService line 154)
_lightActuator.setState("on".equals(value));
as if _lightActuator is null ??
I don't know if sensors are working or not... I checked their connections many times, so... I think the problem is in another place...
Could you help me in some way?
Thank you so much for your time.
|
|
| | |
Re: Errors starting kura with greenhouse example [message #1699124 is a reply to message #1699107] |
Sun, 21 June 2015 16:56 |
Diego Alejandro Palmeira Messages: 8 Registered: June 2015 |
Junior Member |
|
|
Hello,
After uninstall Kura 1.0.0 and install 1.2.0 in my Raspberry PI b+, I got the same error when I try to send a message from my Mosquitto server over my LAN:
If I send a msg to turn the light on...
$mosquitto_pub -t "liferay/device1/actuators/light" -m "on" -q 0 -r
I see the same original error in the kura.log...
2015-06-21 15:31:29,781 [MQTT Call: B8:27:EB:81:B0:9C] DEBUG o.e.k.c.c.c.CloudCallServiceImpl - Message arrived on topic: 'liferay/device1/actuators/light'
2015-06-21 15:31:29,783 [MQTT Call: B8:27:EB:81:B0:9C] ERROR o.e.k.c.d.DataServiceListeners - Unexpected Throwable
java.lang.NullPointerException
at org.eclipse.iot.greenhouse.sensors.raspberrypi.Pi4JGreenhouseSensorService.setActuatorValue(Pi4JGreenhouseSensorService.java:154)
at org.eclipse.iot.greenhouse.publisher.GreenhousePublisher.onMessageArrived(GreenhousePublisher.java:149)
Besides that, I got another errors, so, I think I need to resolve it one by one.
The first problem to solve is the lose of WIFI connection.
This is my env:
- MacBook Pro with mosquitto server running to make tests in my local area network using a WIFI conn.
- Raspberry PI B+ with raspbian wheezy. (I bought it some weeks ago) + a installed Eclipse Kura 1.2.0. I raised up log levels from INFO to DEBUG in the log4j.properties file for a little bit more verbosity.
- jdk8 in the RB. It's installed by default... I've noticed Kura works with jdk7, maybe this is part of the problem.., I don't know.
- Home WIFI network, basically I want to connect my Raspberry using mini-usb WIFI dongle (I bought it at Adafriuit and this is a RTL8188CUS). Looking for the web it should to be compatible it use driver rtl871xdrv (htt p : // elinux.org/RPi_USB_Wi-Fi_Adapters)
- I want the Raspberry's IP should be 192.168.1.137, and for my Macbook Pro with Mosquitto server: 192.168.1.136
Well here is the problem...
1) When you install Kura in Raspberry, it has some dependencies... one of this is isc-dhcp-server and it isn't well configured after installation process, causing fails in the RB starup. So, to solve this problem I've configured by hand some files:
- I put INTERFACES="wlan0" in the /etc/default/isc-dhcp-server
- Then I had to modify the /etc/dhcp/dhcpd.conf file:
significant parts...
I commented this... (I'm not sure if this is necessary)
# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
#option domain-name-servers 8.8.8.8, 8.8.4.4;
and added this to define the dhcp range..
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1;
}
Then I've changed the generated /etc/network/interfaces file with the following content:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
#post-up route del default dev eth0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.137
netmask 255.255.255.0
gateway 192.168.1.1
# WIFI Settings
wpa-ssid xxxxxxx
wpa-passphrase xxxxxx
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wireless-channel 1
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface home inet static
#address 192.168.1.137
#netmask 255.255.255.0
#gateway 192.168.1.1
#iface default inet dhcp
Note: I tested the option of using wpa_supplicant.conf file, and WIFI works with the same effects, but in this case Kura complains with a message about it doesn't have NETMASK, etc...
So for simplicity, I decided to leave this WIFI SSID and PASS configs in the /etc/network/interfaces file, but I'm not sure if for Kura this is correct, or I could use wpa-roam instad. This second choice looks more smart.
After that when I startup my RB, with or without wire (eth0), the WIFI (wlan0) works perfectly and the connection is stable until the server KURA STARTS! (the effect is the same even without GreenHouse demo installed.)
Before KURA starts the nwework works fine, even if I kill KURA process the connection works for ever well!
Note the following output, the wlan0 is present and has the correct IP and I can access my RB via SSH from my local network using my MacBook.
pi@raspberrypi ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:81:b0:9c
inet addr:192.168.1.128 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2064 (2.0 KiB) TX bytes:750 (750.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:400 (400.0 B) TX bytes:400 (400.0 B)
wlan0 Link encap:Ethernet HWaddr 40:a5:ef:03:2b:8a
inet addr:192.168.1.137 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:159 errors:0 dropped:84 overruns:0 frame:0
TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25245 (24.6 KiB) TX bytes:17935 (17.5 KiB)
Some minutes later, KURA starts and removes my wlan0 interface at this point!
2015-06-21 15:28:29,394 [WifiMonitor Thread] DEBUG o.e.k.l.n.w.WpaSupplicantManager - stopping wpa_supplicant
2015-06-21 15:28:29,418 [WifiMonitor Thread] INFO o.e.k.c.l.u.LinuxProcessUtil - executing: killall wpa_supplicant
2015-06-21 15:28:29,430 [SafeProcessExecutor] DEBUG o.e.k.c.u.SafeProcess - Executing: [killall, wpa_supplicant]
2015-06-21 15:28:29,612 [WifiMonitor Thread] INFO o.e.k.c.l.u.LinuxProcessUtil - killall wpa_supplicant returned with exit value:0
2015-06-21 15:28:29,718 [Component Resolve Thread (Bundle 6)] INFO o.e.k.w.Console - activate...
2015-06-21 15:28:29,808 [Component Resolve Thread (Bundle 6)] INFO o.e.k.w.AuthenticationManager - db is file
After some seconds... network comes back available via wire eth0 (ssh) but my wlan0 interface is missing!
pi@raspberrypi ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:81:b0:9c
inet addr:192.168.1.128 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:182 errors:0 dropped:0 overruns:0 frame:0
TX packets:145 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12448 (12.1 KiB) TX bytes:63458 (61.9 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:500 (500.0 B) TX bytes:500 (500.0 B)
Rare effect is eth0 says 192.168.1.128, and I'm still connected to 192.168.1.137 via SSH. If I disconnect the ethernet cable, I get disconnected ! It's like the IP configured for wlan0 is used by the eth0 interface ?? extrange effect...
In th Kura web UI --> Network section, I only see "lo" and "eth0" interfaces... where is my wlan0 ?? is it normal ? or my wlan0 should to appears here? :S
Well, as you can see, I need to solve the WIFI problem first, and then go to the next I think.
I attached here the kura.log.
Can you help me?
Thank you!
-
Attachment: kura.log
(Size: 450.51KB, Downloaded 165 times)
|
|
|
Re: Errors starting kura with greenhouse example [message #1699197 is a reply to message #1699124] |
Mon, 22 June 2015 13:28 |
Diego Alejandro Palmeira Messages: 8 Registered: June 2015 |
Junior Member |
|
|
Objectives of my proof of concept:
- I only want to test the Kura Demo GreenHouse project using Temp and Led sensors to publish their data in a LAN Mosquitto server.
- After that, I want to send a message to my Mosquitto server and it route the message to turn on & off the light (led).
A little more info:
I've decided to uninstall everything (Kura 1.2.0 + his dependencies) and reinstall all again from scratch.
1) I installed one by one all dependencies without problems:
- hostapd
- bind9
- isc-dhcp-server
- iw
- monit
- dos2unix
- telnet
After that, I've rebooted my RB, and everything was started up [Ok]
2) Then, I've installed Kura 1.2.0
sudo dpkg -i kura_1.2.0_raspberry-pi-bplus_armv6.deb
After that, in the next reboot, isc-dhcp-server fails !
I noticed /etc/network/interfaces file was changed. I put my old file with the original interfaces and IPs configs, and dhcp works again.
4) After that, bind9 fails, so I noticed some configuration with a bad IP in file /etc/bind/named.conf
I replaced: 172.16.0.1 in order to match my network:
allow-query {192.168.1.1/24;};
After this change, all services started up [OK] again.
5) I've changed the WIFI usb driver at:
sudo nano /opt/eclipse/kura/data/kuranet.conf
#net.interface.wlan0.config.wifi.infra.driver=nl80211
net.interface.wlan0.config.wifi.infra.driver=rtl871xdrv
6) Then also put wlan0 at:
sudo nano /opt/eclipse/kura/kura/kura_custom.properties
kura.primary.network.interface=wlan0
7) Then Kura starts ok, but fails with the following error:
2015-06-21 22:21:05,550 [SafeProcessExecutor] DEBUG o.e.k.c.u.SafeProcess - Executing: [hostapd, -B, /etc/hostapd.conf]
2015-06-21 22:21:05,644 [WifiMonitor Thread] ERROR o.e.k.l.n.w.HostapdManager - failed to start hostapd for unknown reason
2015-06-21 22:21:05,744 [WifiMonitor Thread] WARN o.e.k.n.a.m.WifiMonitorServiceImpl - Error during WiFi Monitor handle event
org.eclipse.kura.KuraException: An internal error occurred. {0}
at org.eclipse.kura.net.admin.NetworkAdminServiceImpl.enableInterface(NetworkAdminServiceImpl.java:812)
at org.eclipse.kura.net.admin.monitor.WifiMonitorServiceImpl.enableInterface(WifiMonitorServiceImpl.java:556)
at org.eclipse.kura.net.admin.monitor.WifiMonitorServiceImpl.monitor(WifiMonitorServiceImpl.java:291)
at org.eclipse.kura.net.admin.monitor.WifiMonitorServiceImpl.access$1(WifiMonitorServiceImpl.java:205)
at org.eclipse.kura.net.admin.monitor.WifiMonitorServiceImpl$1.run(WifiMonitorServiceImpl.java:609)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.eclipse.kura.KuraException: An internal error occurred.
at org.eclipse.kura.KuraException.internalError(KuraException.java:102)
at org.eclipse.kura.linux.net.wifi.HostapdManager.start(HostapdManager.java:52)
at org.eclipse.kura.net.admin.NetworkAdminServiceImpl.enableWifiInterface(NetworkAdminServiceImpl.java:1310)
at org.eclipse.kura.net.admin.NetworkAdminServiceImpl.enableInterface(NetworkAdminServiceImpl.java:796)
... 9 more
Caused by: org.eclipse.kura.KuraException: An internal error occurred. failed to start hostapd for unknown reason
at org.eclipse.kura.KuraException.internalError(KuraException.java:113)
at org.eclipse.kura.linux.net.wifi.HostapdManager.start(HostapdManager.java:48)
... 11 more
2015-06-21 22:21:07,977 [Component Resolve Thread (Bundle 6)] INFO o.e.k.w.s.s.FileServlet - Servlet org.eclipse.kura.web.server.servlet.FileServlet initialized
For some reason WifiMonitorServiceImpl can't work properly.
Thank you for your help.
Diego
|
|
| |
Re: Errors starting kura with greenhouse example [message #1699290 is a reply to message #1699243] |
Tue, 23 June 2015 09:14 |
Diego Alejandro Palmeira Messages: 8 Registered: June 2015 |
Junior Member |
|
|
Thank you Dave,
I removed all again, and installed the "no net" version. This looks better, much more simple, and I have no errors!, my WIFI works stable, and well.
I decided to test the original greenhouse example pointing my Kura to mqtt://iot.eclipse.org:1883/ and using this page for test: http://iot.eclipse.org/java/demo/app/#/greenhouses/remote/diegotest1
No data is showed for temp sensor in the page (and no errors in log debug mode), but if I do click over the Lamp image, I receive a message and then the same error appears in my Kura Log:
2015-06-23 09:02:53,322 [MQTT Call: B8:27:EB:81:B0:9C] DEBUG o.e.k.c.c.c.CloudCallServiceImpl - Message arrived on topic: 'javaonedemo/diegotest1/actuators/light'
2015-06-23 09:02:53,324 [MQTT Call: B8:27:EB:81:B0:9C] ERROR o.e.k.c.d.DataServiceListeners - Unexpected Throwable
java.lang.NullPointerException
at org.eclipse.iot.greenhouse.sensors.raspberrypi.Pi4JGreenhouseSensorService.setActuatorValue(Pi4JGreenhouseSensorService.java:154)
at org.eclipse.iot.greenhouse.publisher.GreenhousePublisher.onMessageArrived(GreenhousePublisher.java:149)
at org.eclipse.kura.core.data.DataServiceListeners.onMessageArrived(DataServiceListeners.java:106)
at org.eclipse.kura.core.data.DataServiceImpl.onMessageArrived(DataServiceImpl.java:332)
at org.eclipse.kura.core.data.transport.mqtt.DataTransportListeners.onMessageArrived(DataTransportListeners.java:144)
at org.eclipse.kura.core.data.transport.mqtt.MqttDataTransport.messageArrived(MqttDataTransport.java:602)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:354)
at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:162)
at java.lang.Thread.run(Thread.java:744)
Why Kura can't process the msg? I only installed the package original version of code example: org.eclipse.greenhouse.iot-0.1.0.dp
Any idea?
|
|
|
Re: Errors starting kura with greenhouse example [message #1699378 is a reply to message #1699290] |
Tue, 23 June 2015 21:29 |
David Woodard Messages: 420 Registered: July 2014 |
Senior Member |
|
|
I have to say I am a bit stumped. I have tried the demo on 2 different Raspberry Pis, both running Kura v1.2.0 and Java SE 8, both using your username of "diegotest1", and both are behaving as expected. Can you try subscribing to the topic from a stand alone MQTT client (ex: mosquitto_sub)? I am wondering if the message is getting corrupted. For reference, I am getting this from the mosquitto client:
$ ./mosquitto_sub -d -v -i test -q 0 -h iot.eclipse.org -t javaonedemo/diegotest1/#
Client test sending CONNECT
Client test received CONNACK
Client test sending SUBSCRIBE (Mid: 1, Topic: javaonedemo/diegotest1/#, QoS: 0)
Client test received SUBACK
Subscribed (mid: 1): 0
Client test received PUBLISH (d0, q0, r1, m0, 'javaonedemo/diegotest1/sensors/temperature', ... (5 bytes))
javaonedemo/diegotest1/sensors/temperature 24.16
Client test received PUBLISH (d0, q0, r1, m0, 'javaonedemo/diegotest1/sensors/light', ... (2 bytes))
javaonedemo/diegotest1/sensors/light on
Client test received PUBLISH (d0, q0, r0, m0, 'javaonedemo/diegotest1/sensors/temperature', ... (5 bytes))
javaonedemo/diegotest1/sensors/temperature 24.28
Client test received PUBLISH (d0, q0, r0, m0, 'javaonedemo/diegotest1/actuators/light', ... (3 bytes))
javaonedemo/diegotest1/actuators/light off
Client test received PUBLISH (d0, q0, r0, m0, 'javaonedemo/diegotest1/sensors/light', ... (3 bytes))
javaonedemo/diegotest1/sensors/light off
Client test received PUBLISH (d0, q0, r0, m0, 'javaonedemo/diegotest1/actuators/light', ... (2 bytes))
javaonedemo/diegotest1/actuators/light on
Client test received PUBLISH (d0, q0, r0, m0, 'javaonedemo/diegotest1/sensors/light', ... (2 bytes))
javaonedemo/diegotest1/sensors/light on
--Dave
|
|
|
Re: Errors starting kura with greenhouse example [message #1699412 is a reply to message #1699378] |
Wed, 24 June 2015 07:43 |
Diego Alejandro Palmeira Messages: 8 Registered: June 2015 |
Junior Member |
|
|
Hi Dave, I've tested the same from my MacBook inside my local network, and this is the result.
$ mosquitto_sub -d -v -i test -q 0 -h iot.eclipse.org -t javaonedemo/diegotest1/#
Client test sending CONNECT
Client test received CONNACK
Client test sending SUBSCRIBE (Mid: 1, Topic: javaonedemo/diegotest1/#, QoS: 0)
Client test received SUBACK
Subscribed (mid: 1): 0
Client test received PUBLISH (d0, q0, r1, m0, 'javaonedemo/diegotest1/sensors/temperature', ... (5 bytes))
javaonedemo/diegotest1/sensors/temperature 24.41
Client test received PUBLISH (d0, q0, r1, m0, 'javaonedemo/diegotest1/sensors/light', ... (2 bytes))
javaonedemo/diegotest1/sensors/light on
But, I don't know if I have to do this from my Raspberry PI B+ ? maybe installing mosquitto client first?
Thank you for your help!
Diego
|
|
| | | | | |
Goto Forum:
Current Time: Sat May 04 15:47:48 GMT 2024
Powered by FUDForum. Page generated in 0.04073 seconds
|