Menu

NoClassDefFoundError for RXTXCommDriver in comm_linux

Help
2012-12-26
2013-01-09
  • Guido Zockoll

    Guido Zockoll - 2012-12-26

    I tried to hijack the comm_linux bundle and the tjx10 bundle for my apache-karaf (based on felix) installation.

    I installed RXTXcomm-API 2.2.0-pre2 and comm_linux 2.0.0 with are both resolved. But during runtime i got

    org.osgi.framework.BundleException: Activator start error in bundle org.knopflerfish.bundle.comm-linux [92].
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1247)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1219)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:508)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at info.piayda.bundle.comm.linux.Activator.start(Activator.java:19)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
    ... 6 more

    As far as i can see, it should be visible:

    Symbolischer Name org.knopflerfish.bundle.comm-linux
    Version 2.0.0
    Bundle Location file:/home/guido/java/apache-karaf-2.3.0/deploy/comm-linux_all-2.0.0.jar
    Letzte Bundle Status Änderung Wed Dec 26 06:42:51 CET 2012
    Bundle Dokumentation http://www.knopflerfish.org/releases/3.4.0/docs/bundledoc/index.html?docpage=serial
    Vendor Piayda/RXTX
    Beschreibung Native driver for linux javax.comm using the RXTX library. Note that this bundle is LGPL and contains full source to rxtx
    Start Level 80
    Bundle Classpath .,RXTXcomm.jar,comm.jar
    Exportierte Packages javax.comm,version=2.0.0
    Importierte Packages gnu.io,version=2.2.0 from org.knopflerfish.bundle.rxtxcomm-API (91)
    org.osgi.framework,version=1.7.0 from org.apache.felix.framework (0)
    Importierende Bundles org.knopflerfish.bundle.tjx10 (93)

    gnu.io is on the bundle classpath and its imported from the other bundle.

    Does anyone have an idea whats happening?

    Regards,

    Guido

     
  • Guido Zockoll

    Guido Zockoll - 2012-12-26

    sorry for double posting. sf send me an error 500

     
  • Gunnar Ekolin

    Gunnar Ekolin - 2013-01-09

    Hi,

    As I understand it you have gnu.io on the bundle classpath (RXTXcomm.jar) but then you also import the gnu.io-package. For the import to work you need to have a bundle that exports the gnu.io-package.

    So I see two alternative solution to your problem:
    1) Remove the import of gnu.io from the manifest above.
    2) Add an export-package for gnu.io to your manifest.

    In the first case your bundle will use its private copy of gnu.io from the bundle-classpath, and the entire gnu.io package will be private to your bundle.

    In the second case the gnu.io-package will be visible to all interested parties and your bundle will import the package from the exporter that the framework has selected for it during the resolve phase (could be itself, but the important thing is that all users of the package gets it from the same exporter so that instances of classes in this package can be shared/exchanged between bundles).

    \GE

     

Log in to post a comment.

MongoDB Logo MongoDB