Bug when launching openems

Hello,
I’m trying to run openems on a Raspberry pi 4 but I have a run error.

! Failed to start bundle com.google.guava.failureaccess-1.0.1, exception Could not resolve module: com.google.guava.failureaccess [39]

Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

I have this error when i’m running on linux desktop which has the openJDK 11 providing jre 1.8.
when I build it from linux I have the same issue.

What can I do?

Hi Siden,

this might indeed be related to JDK 11 - I believe I have seen this issue before. Can you try in Eclipse IDE if “Resolve” works for “EdgeApp.bndrun”.

Alternatively use the following commands in the command line:

gradlew build -x test
gradlew resolve.EdgeApp
gradlew buildEdge

This will generate a jar-file “openems-edge.jar” in the “build” directory. Try again with this file please.

Regards,
Stefan

Hello,
resolve is not working

Resolution failed. Capabilities satisfying the following requirements could not be found:
[io.openems.backend.timedata.influx version=1.0.0.201907130930]
  ⇒ osgi.wiring.package: (&(osgi.wiring.package=io.openems.backend.metadata.api)(&(version>=1.0.0)(!(version>=2.0.0))))
[io.openems.backend.timedata.api version=1.0.0.201907130930]
  ⇒ compile-only: null
[io.openems.backend.metadata.api version=1.0.0.201907130930]
  ⇒ compile-only: null
[log4j version=1.2.16]
  ⇒ osgi.wiring.package: (&(osgi.wiring.package=javax.jmdns))
[io.openems.backend.uiwebsocket.api version=1.0.0.201907130930]
  ⇒ compile-only: null
[io.openems.backend.edgewebsocket.api version=1.0.0.201907130930]
  ⇒ compile-only: null

I still have errors when i’m running gradlew build -x test

> Task :io.openems.common:compileJava Putting task artifact state for task ':io.openems.common:compileJava' into context took 0.0 secs. Executing task ':io.openems.common:compileJava' (up-to-date check took 0.002 secs) due to: Task has failed previously. warning: openems :Snapshot and/or buildnumber not set {"timestamp":null, "buildNumber":"0", "localCopy":false} in org.osgi:osgi.enroute.pom.distro:2.1.0-SNAPSHOT error : Cannot find /error/org.apache.felix.configadmin;version=1.8 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]] error : org.apache.felix.configadmin;version=1.8 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]] error : Cannot find /error/osgi.enroute.junit.wrapper;version=4.12 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]] error : Cannot find /error/osgi.enroute.hamcrest.wrapper;version=1.3 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]] error : osgi.enroute.junit.wrapper;version=4.12 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]] error : osgi.enroute.hamcrest.wrapper;version=1.3 Not found in [bnd-cache [/home/denis/git/openems/cnf/cache/4.1.0/bnd-cache r/w=false], BndPomRepository [name=Central, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-pom.xml, inited=true], Local, Release, BndPomRepository [name=Distro, localRepo=/home/denis/.m2/repository, location=/home/denis/git/openems/cnf/cache/enroute-distro.xml, inited=true]]

I’ve just teste on my raspberry pi but I did not installed eclipse on it so I direcly teste the gradlew commands

The two first commands works fine but when I’m running ./gradlew buildEdge i have the following message

> Task :updateVersion FAILED

FAILURE: Build failed with an exception.

* Where: 
Build file '/home/pi/EMS/openems/build.gradle' line: 29

* What went wrong: 
Execution failed for task ':updateVersion'.
> Could not find matching constructor for: java.io.File(java.io.File)

Hello,
I could finally compile the edge.jar file by replacing the line 29 of build.gradle file from
def openemsConstantsFile = new File(openemsConstantsFilePath)

to
def openemsConstantsFile = new openemsConstantsFilePath

But the .jar file generated gives exactly the same error.

The I installed the java jre 8 on the raspberry and it worked directly

Ok, thanks for digging into this problem. So there seems to be an incompatibility with OpenJDK 11. I opened an issue for that on Github: https://github.com/OpenEMS/openems/issues/655

Please don’t hesitate to get in touch if you have further problems.

Regards,
Stefan

In my experience, OpenJDK 11 is very often incompatible with projects developed with Oracle JDK 1.8, and should generally be avoided if possible. This is an upstream issue, in my humble opinion.

Thanks Kyle, good to know. I’d still try to keep compatibility with all Java versions from version 8 - but this one does indeed not have a very high priority for me right now.

Small addition for everyone who struggles to run the openems jar and is not an installation expert:
I tried to run Edge on a RaspberryPi4 too (no eclipse or anything) and couldn’t start properly without getting 100+ unresolved requirements exceptions, even though Java-8 was installed.

Only installing java-8 (= java-1.8.0) is not enough. You need to choose it as your active version.
Getting Oracle JDK is not necessary btw. OpenJDK does just fine, just not on version 11 for whatever reason (as pointed out above).

Use
sudo update-alternatives --config java

to list your installed java versions and switch to your desired one.
Choosing java-8-openjdk did the job for me.

1 Like