Hi,
I’m trying to make use of the mbus bridge that is implemented in feature/mbus_bridge_abb_b23. The implementation uses org.openmuc.jmbus as an external jar. The bundle dependencies (import/export) are not the problem as far as I understand and I checked all the setup parts as described in https://community.openems.io/t/how-to-integrate-an-external-library/62. But when I try to activate the mbus bridge bundle some library that is needed in jmbus cannot be loaded. I get the same error
(Could not load lib from jar and from system. gnu.io.LibLoadException: directory does not exist /libs)
that is also discussed here.
The answer that seemed to work there is:
"…add a plugin to the maven build which produces a JAR with all dependencies included. Like described here: https://www.mkyong.com/maven/create-a-fat-jar-file-maven-assembly-plugin/ However, what’s still odd, you have to add the library path like mentioned above:
-Djava.library.path=/usr/lib/jni
For my understanding this should not be necessary anymore. Nevertheless, without the path it is not working.
"
Now my question is, given that this would be the only solution, what is the best way to do this? I’m not the biggest expert in maven, gradle, etc. and I don’t quite look through all the details of plugin integration in bnd so maybe I just missed something dumb …
I’ll ping @ljonka here, as he is the author of the pull-request.
I was not able to try the mbus bridge yet, as I don’t have a device here to test with. But during the last weeks I developed a OneWire bridge which also uses RXTX for serial access (it’s in review currently: https://github.com/OpenEMS/openems/pull/891). So I gained some knowledge about JNI.
The problem with RXTX is, that it does not bring its own native JNI library, so that has to be installed manually. This is a problem, that is solved in jSerialComm, that is used for the Modbus communication by j2mod.
I found some documentation on OpenMUCs jmbus implementation here, here and here. If you run your JAR file on a Debian based linux, it should be sufficient to execute
Hi Stefan,
Thanks for your quick reply! You were right with the RXTX/JNI Problem, having rxtx installed it worked for me executing OpenEMS as a jar with the argument -Djava.library.path=/usr/lib/jni (on linux).
So did the mbus-bridge work for you? As I am not able to test it myself, I was not able to approve the pull-request till now. If it worked for you I can approve it - or at least only concentrate on coding guideline mistakes.It might help if you or @ljonka could provide a readme.adoc file that explains the steps to make it work. See my OneWire-bundle readme for an example.