Have a binding, several users ( https://community.openhab.org/t/busch-jaeger-free-home/ ), which make use of the rocks.xmpp library, i.e. XMPP over websocket towards a smarthome gateway. As the smarthome gateway setup is not following official XMPP/Websocket protocol, the rocks.xmpp library is customized to fit the gateway protocol, thus not considered an option to move to different library.
Running OH 2.4.0 (RPi 3b+ with OpenHabian), the binding runs with success. Trying to upgrade to OH 2.5.0, the binding fails the initial stream negotiation, and it appears as there are problems initiating/reading incoming XML stream from the smarthome gateway, i.e. might be related to javax.xml (see error below). Downgrading to 2.4.0 makes the binding run as normal. Any ideas what could be causing the error?
18:03:48.461 [safeCall-1] ERROR o.e.s.c.i.c.AbstractInvocationHandler:100 - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.freeathome.internal.handler.FreeAtHomeBridgeHandler@60b911de': Requested factory [com.sun.xml.internal.stream.XMLInputFactoryImpl, com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl] could not be instantiated
javax.xml.stream.FactoryConfigurationError: Requested factory [com.sun.xml.internal.stream.XMLInputFactoryImpl, com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl] could not be instantiated
at javax.xml.stream.FactoryLocator.loadFactory(FactoryLocator.java:136)
at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:121)
at javax.xml.stream.FactoryLocator.locate(FactoryLocator.java:52)
at javax.xml.stream.XMLInputFactory.newFactory(XMLInputFactory.java:48)
at rocks.xmpp.core.session.XmppSessionConfiguration.<init>(XmppSessionConfiguration.java:144)
at rocks.xmpp.core.session.XmppSessionConfiguration.<init>(XmppSessionConfiguration.java:74)
at rocks.xmpp.core.session.XmppSessionConfiguration$Builder.build(XmppSessionConfiguration.java:551)
at org.openhab.binding.freeathome.internal.handler.FreeAtHomeBridgeHandler.connectGateway(FreeAtHomeBridgeHandler.java:196)
at org.openhab.binding.freeathome.internal.handler.FreeAtHomeBridgeHandler.initialize(FreeAtHomeBridgeHandler.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152)
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The binding is not part of the official bundle, although it has been available for download from Marketplace.
Have been in contact with the original developer, and we have been cooperating on further development/customization until last summer. Havent’t received any feedback from the developer since, so have been following up development of the binding to follow gateway upgrades and to maintain working binding / follow latest OH environment.
Refurbished the binding according to mvn + bnd procedure, and have been using latest Eclipse IDE to generate new jar files. So really not sure what/where went wrong. As mentioned, everything works ok running 2.4.0, but gives the error above for 2.5.0.
Still stuck with jaxb / javax.xml implementation, and seek some further expertise advise. I have openhab.tp-jaxb implemented in the feature.xml file. The binding is based on some dependencies as jar files in the /lib folder (customized library). Other (standard) maven dependencies are implemented in the pom.xml and feature.xml (some non-osgi packages which then are wrapped).
Have been working through different options for dependencies (pom.xml and feature.xml). Now I am trying to implement jakarta.xml.bind-api 2.3.2 as dependency in the pom file, however, this generates error during mvn clean install:
Classes found in the wrong directory: {META INF/versions/9/javax/xml/bind/ModuleUtil.class=javax.xml.bind.ModuleUtil}
Apparently this would relate to issue with some package/library built with Java 9…? In my local setup, I am running Zulu Java 8 (1.8.0_232).
Searching similar issues, the proposed solution is to implement (to get the project built):
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<instructions>
<_fixupmessages>"Classes found in the wrong directory";is:=warning</_fixupmessages>
</instructions>
</configuration>
</plugin>
Have tried implementing the above code as part of openhab2-addons bundle pom, but still get the same “Classes found in wrong directory...” error.
Binding is working ok under OH 2.4.0 environment (openjdk version “1.8.0_152”). But fails both for OH 2.5.0 (upgrade using OpenHabian config tool) and Eclipse IDE demo app.
For me it seems that you got a version of JAXB which was compiled for Java 9+ and tooling which is for Java 8.
One of new features implemented in Java 9 was multi release JAR which can ship and work with multiple versions of virtual machine. Obviously older tools might not be too happy with this.
Have tried to customize/rebuild OH bundle pom, and also tried to rebuild the jakarta.xml.bind internal pom with what you suggest, although, problem remains.
Continue my search for help to be able to run the customized ABB Free@Home binding under OH 2.5.x (XMPP over Websocket).
Have implemented required maven dependencies in my pom.xml file. openhab.tp-jaxb is implemented as feature dependency. Some customized rocks.xmpp source code is implemented and maven built inside my /lib folder (customization needed as the smarthome gateway is following incorrect XMPP/Websocket protocol) and thus implemented to my build path. The binding is rebased from the latest 2.5.x branch. I am using latest Eclipse IDE (2019-12) for development, on a mac running OpenJDK 1.8.0_232 (Zulu) 64-bit.
Some progress has been made from initial issues above. Binding still runs with success on OpenHabian, OH 2.4.0, initially set up with OpenJDK 1.8.0_152 (Zulu), 32-bit.
Have tried setting up a test environment locally on my mac as well (openjdk 1.8.0_232). Binding runs with success on OH 2.4.0. For OH 2.5.0 I have had a couple of successful connects to my gateway, although without making alterations to code, just performing OH reboot / binding reinstall.
Also just tried updating OpenHabian software (now running OpenJDK 1.8.0_222, Zulu). For OH 2.4.0, the binding still runs with succes, however, still unable to connect to my gateway after upgrading to OH 2.5.0. The latest error code now states:
I think I finally managed to solve this issue, and have now been able to implement the customized binding into OH 2.5.0 (just for future reference):
As it might appear, having customized source code in /lib folder set up as maven build itself (pom.xml files set up with dependencies), using the maven built jar files from /lib folder as part of build path in main project, I ended up with some dependencies from the /lib folder which were not fully implemented as part of the main project. Although, the apparent missing dependency from /lib folder was not generating any build errors.
As part of main project, I had implemented javax.websocket-api as a dependency in my pom.xml file (as dependency from source code in /lib folder). And also had implemented org.glassfish.tyrus packages as required. Although, some source code within the /lib folder had dependency for a org.glassfish.tyrus package also having dependency for jakarta.websocket-api.
So, when adding dependency for jakarta.websocket-api also in the main project pom.xml file, the binding started to work as supposed to within OH 2.5.0.