Closed wborn closed 6 years ago
Here's the org.openhab.persistence.rrd4j-1.13.0-SNAPSHOT.jar that can be used for testing the latest RRD4J master (3.2-SNAPSHOT) with openHAB 2.4.0-SNAPSHOT on Java 9/10/11. The bundle worked for me with both Java 8 and Java 11.
RRD4j 3.3 that solve this issue has been released.
Thanks for the new release @fbacchella! There does seem to be an issue now when using rrd4j-3.3.jar
on Java 8:
22:22:50.556 [ERROR] [rg.eclipse.smarthome.core.persistence] - bundle org.eclipse.smarthome.core.persistence:0.10.0.201809271800 (105)[org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl(271)] : The addPersistenceService method has thrown an exception
java.lang.NoSuchMethodError: java.nio.MappedByteBuffer.position(I)Ljava/nio/MappedByteBuffer;
at org.rrd4j.core.RrdNioBackend.read(RrdNioBackend.java:172) ~[?:?]
at org.rrd4j.core.RrdBackend.readString(RrdBackend.java:304) ~[?:?]
at org.rrd4j.core.RrdPrimitive.readString(RrdPrimitive.java:87) ~[?:?]
at org.rrd4j.core.RrdString.get(RrdString.java:33) ~[?:?]
at org.rrd4j.core.Header.isRrd4jHeader(Header.java:216) ~[?:?]
at org.rrd4j.core.Header.validateHeader(Header.java:220) ~[?:?]
at org.rrd4j.core.RrdDb.<init>(RrdDb.java:277) ~[?:?]
at org.rrd4j.core.RrdDb.<init>(RrdDb.java:204) ~[?:?]
at org.rrd4j.core.RrdDb.<init>(RrdDb.java:233) ~[?:?]
at org.openhab.persistence.rrd4j.internal.RRD4jService.getDB(RRD4jService.java:258) ~[?:?]
I think it is caused because the JAR was compiled with Java 11. When I compile the 3.3 tag with Java 8 it works on both Java 8 and Java 11. That's also how I've been testing the new code. After searching for the exception it looks very similar to the issue fixed in https://github.com/apache/felix/pull/114.
Indeed:
JAVA_HOME=<JAVA9> mvn clean compile ; JAVA_HOME=<JAVA1.8> mvn verify -Dmaven.main.skip
fails with the same exception.
JAVA_HOME=<JAVA11> mvn clean compile ; JAVA_HOME=<JAVA9> mvn verify -Dmaven.main.skip
works.
But the patch tried by felix don't works for me. I'll keep investigating, but I'm afraid I will fail back to compile with Java8.
It's should be resolved in 3.3.1.
Thanks a lot @fbacchella! The new version works well with both Java 8 and 11. :+1: So I've created a PR https://github.com/openhab/openhab1-addons/pull/5675 to integrate it.
When using the RRD4j persistence add-on with newer Java versions (9/10/11) the following NoSuchMethodErrors are logged:
As a result it's not possible to store/read data in a RRD database with the add-on.
This is a very visible issue for new openHAB users because the RRD4j persistence add-on is used as chart data source in the Demo.
To support Java 11 (https://github.com/openhab/openhab-distro/issues/768), we need to upgrade the rrd4j library to a version which contains the fix for https://github.com/rrd4j/rrd4j/issues/72.
So far the fix seems to be working well when updating the rrd4j JAR to the current (unreleased) master (https://github.com/openhab/openhab-distro/pull/761#issuecomment-421546648).
There is currently no released rrd4j version that contains this fix.