Error on weather binding when starting openHAB2

Hi,

thanks for all the hard-work towards openHAB2! openHAB is already really cool but openHAB2 seems to be (or get) even more sophisticated on many levels.

I just downloaded and installed the new openHAB distribution packages.
Before starting openHAB2, I configured some bindings in the addons.cfg. Now, when starting openHAB2, I get an exception on the weather binding (and at the beginning on the transform):

2016-01-11 21:42:45.745 [ERROR] [org.eclipse.smarthome.core.transform] - [org.eclipse.smarthome.action.transformation.action(74)] Circular reference detected, getService returning null
2016-01-11 21:42:59.763 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-01-11 21:42:59.965 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-01-11 21:43:00.561 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been started
2016-01-11 21:43:00.585 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been started
2016-01-11 21:43:00.591 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been shut down
2016-01-11 21:43:00.608 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been started
2016-01-11 21:43:00.614 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been shut down
2016-01-11 21:43:01.580 [INFO ] [b.core.service.AbstractActiveService] - Exec Refresh Service has been shut down
2016-01-11 21:43:01.830 [ERROR] [org.openhab.binding.weather         ] - [org.openhab.binding.weather(158)] bind method [addBindingProvider] not found; Component will fail
2016-01-11 21:43:01.943 [ERROR] [org.openhab.binding.weather         ] - [org.openhab.binding.weather(158)] bind method [addBindingProvider] not found
2016-01-11 21:43:02.290 [ERROR] [.weather.internal.bus.WeatherBinding] - Error activating WeatherBinding: unexpected element (uri:"", local:"common-id-mappings"). Expected elements are (none)
javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"common-id-mappings"). Expected elements are (none)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:726)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:247)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:242)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:109)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1131)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:556)[:1.8.0_65]
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)[:1.8.0_65]
...
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)[:1.8.0_65]
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)[:1.8.0_65]
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:204)[:1.8.0_65]
    at org.openhab.binding.weather.internal.parser.CommonIdHandler.loadMapping(CommonIdHandler.java:63)
    at org.openhab.binding.weather.internal.bus.WeatherBinding.activate(WeatherBinding.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_65]

I already had a weather.cfg from a previous openHAB2 installation:

# location configuration, you can specify multiple locations
location.myhome.latitude=1.234567
location.myhome.longitude=9.876543
location.myhome.provider=Yahoo
location.myhome.language=de
location.myhome.updateInterval=10

Any ideas?

Yes, I am also a bit unhappy that the move to Karaf causes quite some new problems that previously didn’t exist. But still I think that its benefits weigh more than the problems, so I decided to better do the move now than later.

Regarding the concrete problem in the weather binding: I have no idea what this means, this probably need some code analysis.
At a first glance, I guess this line is the problem: openhab1-addons/bundles/binding/org.openhab.binding.weather/src/main/java/org/openhab/binding/weather/internal/parser/CommonIdHandler.java at main · openhab/openhab1-addons · GitHub
Resources should be loaded through the bundle context, not via the classpath - I would assume that this fixes the issue.

Sorry, this was not at all meant to be any kind of criticism, I am totally excited about the development :smile:

Thanks for the hint what the problem could be. I’ll try it out and report back!

1 Like

Just for documentation (problem not solved yet):

I made some changes how the xml file is loaded, however the exception remains the same.
So I added some debug and found out that the xml file can be read and is available for the unmarshalling.

After googling for the issue, I came across this post: http://osdir.com/ml/users-cxf-apache/2010-08/msg00276.html (which links to http://spring.io/blog/2009/01/19/exposing-the-boot-classpath-in-osgi/)

I’ll try more debugging and reading in the next days…

I just tested the weather binding in OH2 beta 1 and I encounter the same issue.

@dominicdesu Already any ideas on how that can be solved?

I opened an ussue: https://github.com/openhab/openhab-distro/issues/79

Unfortunately not. With my very limited knowledge about OSGi only more questions arise while I try to research the issue :confused:
Here is one more, possibly related, link which I came across: http://mail-archives.apache.org/mod_mbox/karaf-user/201104.mbox/<9F69795E29C890408AC2DAF646C89BB3799D4454F6@MAILBOX.arc.local>

I hope somebody else can look into and solve this issue…

Dominic, which JVM are you using? This error reminds of an issue I encountered before where there was a difference between the java xml jars included in different JVMs.

On my side, here is my JVM version:

java version "1.8.0"
Java™ SE Runtime Environment (build 1.8.0-b132)
Java HotSpot™ Client VM (build 25.0-b70, mixed mode)

So the JVM does not seem the reason.
I think the hottest link is http://osdir.com/ml/users-cxf-apache/2010-08/msg00276.html - as this post was from @cschneider111, maybe he can help us here?

I will look into it. It seems somehow the schema is not recognized.
I have seen a similar thing when the annoation packages were not imported as then these informations are missing.

Just looked into the source code and Manifest. I think the Import-Package for
javax.xml.bind.annotation is missing.

The unmarshaller problem is fixed with the latest build.

Now there is another issue:

23:39:46.995 [ERROR] [.weather.internal.bus.WeatherBinding] - Error activating WeatherBinding: CommonId for provider YAHOO with id 0 already exists
java.lang.IllegalArgumentException: CommonId for provider YAHOO with id 0 already exists
	at org.openhab.binding.weather.internal.parser.CommonIdHandler.addCommonId(CommonIdHandler.java:85)
	at org.openhab.binding.weather.internal.parser.CommonIdHandler.loadMapping(CommonIdHandler.java:73)
	at org.openhab.binding.weather.internal.bus.WeatherBinding.activate(WeatherBinding.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_40]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_40]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_40]
	at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_40]
	at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)

Added https://github.com/openhab/openhab/issues/3829 for tracking.

I’ve opened a PR for the weather binding on OH2. Please try this test JAR to verify the fix and report back either here or on github. Thank you!

The test jar is working for me with Wunderground provider.
Bravo

1 Like

Confirmed here as well with WU and the latest 2.0 snapshot. Thanks @watou

1 Like

Is this jar File integrated in b2?

Yes, the weather binding is working well in OH2 beta 2.

1 Like

can you share how you got weather binding working on openhab2? Mine doesn’t work. I get this message:

016-05-26 17:59:41.089 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=273, bundle=190/mvn:org.openhab.binding/org.openhab.binding.weather/1.9.0.b3]: Updating property weather of configuration org.openhab.weather caused a problem: Empty property ‘location..name’, please check your openhab.cfg!
org.osgi.service.cm.ConfigurationException: weather : Empty property ‘location..name’, please check your openhab.cfg!
at org.openhab.binding.weather.internal.common.WeatherConfig.parseLocation(WeatherConfig.java:113)[190:org.openhab.binding.weather:1.9.0.b3]
at org.openhab.binding.weather.internal.common.WeatherConfig.parse(WeatherConfig.java:80)[190:org.openhab.binding.weather:1.9.0.b3]
at org.openhab.binding.weather.internal.bus.WeatherBinding.updated(WeatherBinding.java:77)[190:org.openhab.binding.weather:1.9.0.b3]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1753)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]