You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Matt Tennant <mt...@4home.com> on 2009/09/15 01:13:28 UTC
Cannot load native library
Hi all,
I have a problem that has me stumped, and I'm looking for any help I can get. I recently ported our company's java code to OSGi bundles, usually running in the Felix framework and embedded in a device with phoneME JVM. Everything works great except for a couple of issues, one of which is that on one of our devices the native libraries won't load. I get an error like this:
Uncaught Exception in thread Serial Communications Thread: java.lang.UnsatisfiedLinkError Can't load /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
java.lang.ClassLoader.loadLibraryInternal(Unknown Source)
java.lang.ClassLoader.loadLibrary(Unknown Source)
java.lang.Runtime.loadLibrary0(Unknown Source)
java.lang.System.loadLibrary(Unknown Source)
gnu.io.RXTXPort.<clinit>(Unknown Source)
java.lang.Class.runStaticInitializers(Unknown Source)
com.fourhome.zwave.SerialComm.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
java.lang.Thread.startup(Unknown Source)
Even though that library file is there:
# ls /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
/var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
# cd /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/
# ls -l
-rw------- 1 0 0 94351 Sep 14 10:46 librxtxSerial.so
I'm starting the bundles in the config.properties file at startup time (pasted below). I've also tried starting everything but the problematic zwave.jar bundle, and then starting that one interactively. When I do that, I get:
-> install file:/usr/lib/fluid/plugins/zwave.jar
ERROR: JarContent: Unable to create library directory.
removing /var/lib/fluid/osgi-config/bundle15/bundle.id
rm ret -1
unlinking /var/lib/fluid/osgi-config/bundle15/bundle.id
b 0
removing /var/lib/fluid/osgi-config/bundle15/bundle.location
rm ret -1
unlinking /var/lib/fluid/osgi-config/bundle15/bundle.location
b 0
removing /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
rm ret -1
unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
b 0
removing /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
rm ret -1
unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
b 0
removing /var/lib/fluid/osgi-config/bundle15/version0.0
rm ret 0
removing /var/lib/fluid/osgi-config/bundle15
rm ret 0
org.osgi.framework.BundleException: Native library does not exist: native/linux/mips/librxtxSerial.so
at org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(Unknown Source)
at org.apache.felix.framework.BundleImpl.createModule(Unknown Source)
at org.apache.felix.framework.BundleImpl.<init>(Unknown Source)
at org.apache.felix.framework.Felix.installBundle(Unknown Source)
at org.apache.felix.framework.Felix.installBundle(Unknown Source)
at org.apache.felix.framework.BundleContextImpl.installBundle(Unknown Source)
at org.apache.felix.shell.impl.InstallCommandImpl.install(Unknown Source)
at org.apache.felix.shell.impl.InstallCommandImpl.execute(Unknown Source)
at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Unknown Source)
at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at java.lang.Thread.startup(Unknown Source)
org.osgi.framework.BundleException: Native library does not exist: native/linux/mips/librxtxSerial.so
In particular, the line that says "ERROR: JarContent: Unable to create library directory." seems promising. When I do things this way, the bundle is never installed and the bundle directory is never created. But I don't know why.
What I'm looking for is any advice on how to tease more information out of Felix about what the problem is with that library. Note that this setup works fine on at least three other embedded platforms as well as on my linux PC. Any help at all is very much appreciated, and I mean that. If there is any additional information that would help I can get it. I've pasted below some other misc. stuff.
Thank you,
Matt
Start command:
-----------------------------
Starting fluid core with this command: 'cvm -Xmx8m -Djava.net.preferIPv4Stack=true -Dcore.data.dir=/var/lib/fluid -Dcore.lon.enable=false -Dcore.manufacturer.name=4Home -Dcore.model.number=CP2000 -Dcore.config.protect=true -Dcore.config.password=4444444444 -Dcore.config.user=4HDEFAULT -Dcore.net.interface=br0 -Dcore.zwave1.interface=/dev/tts/1 -Dcore.logging.level=4 -Dcore.conf.file=/var/lib/fluid/fluid-core.conf -Dorg.osgi.framework.storage=/var/lib/fluid/osgi-config -Dfelix.config.properties=file:/var/lib/fluid/osgi-config/config.properties -jar lib/felix.jar'
config.properties
-----------------------------
felix.log.level=4
felix.auto.start.1= file:lib/commons.jar file:lib/org.apache.felix.configadmin-1.0.10.jar file:lib/org.apache.felix.http.jetty-1.0.1.jar file:lib/org.apache.felix.log-1.0.0.jar file:lib/org.apache.felix.shell-1.2.0.jar file:lib/org.apache.felix.shell.tui-1.2.0.jar file:lib/RXTXcomm.jar file:lib/upnplib.jar file:core.jar file:plugins/ipc.jar file:plugins/led.jar file:plugins/ndc.jar file:plugins/pgw.jar file:plugins/portmap.jar file:plugins/tweenagent.jar file:plugins/upnp.jar file:plugins/zwave.jar
felix.service.urlhandlers=false
org.apache.felix.http.nio=false
org.ungoverned.osgi.bundle.https.enabled=false
Manifest of the zwave.jar bundle:
-----------------------------
Ant-Version Apache Ant 1.7.1
Bundle-Activator com.fourhome.zwave.ZWaveClient
Bundle-ManifestVersion 2
Bundle-Name 4Home ZWave Client
Bundle-NativeCode native/linux/mips/librxtxSerial.so;osname=linux;processor=mips
Bundle-SymbolicName ZWave
Bundle-Version 3.1.4
Created-By 14.0-b16 (Sun Microsystems Inc.)
Import-Package com.fourhome.commons, org.osgi.framework;version="1.3.0"
Manifest-Version 1.0
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Cannot load native library
Posted by Matt Tennant <mt...@4home.com>.
Hi Chris,
As it happens, the device does not have ldd installed. I am looking into getting the source code for ldd, but in any case thank you for your response.
Cheers,
Matt
----- Original Message -----
From: "Chris Custine" <ch...@gmail.com>
To: users@felix.apache.org
Sent: Monday, September 14, 2009 5:13:32 PM GMT -08:00 US/Canada Pacific
Subject: Re: Cannot load native library
I could be mistaken, but IIRC you can also get this error if the library is
linked against another lib that is missing. On linux you can usually figure
these out with ldd.
ldd -v
/var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
Not sure if you have that option on your device, but it might be worth a
try.
Chris
--
Chris Custine
FUSESource :: http://fusesource.com
My Blog :: http://blog.organicelement.com
Apache ServiceMix :: http://servicemix.apache.org
Apache Directory Server :: http://directory.apache.org
On Mon, Sep 14, 2009 at 5:13 PM, Matt Tennant <mt...@4home.com> wrote:
> Hi all,
>
> I have a problem that has me stumped, and I'm looking for any help I can
> get. I recently ported our company's java code to OSGi bundles, usually
> running in the Felix framework and embedded in a device with phoneME JVM.
> Everything works great except for a couple of issues, one of which is that
> on one of our devices the native libraries won't load. I get an error like
> this:
>
> Uncaught Exception in thread Serial Communications Thread:
> java.lang.UnsatisfiedLinkError Can't load
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
> java.lang.ClassLoader.loadLibraryInternal(Unknown Source)
> java.lang.ClassLoader.loadLibrary(Unknown Source)
> java.lang.Runtime.loadLibrary0(Unknown Source)
> java.lang.System.loadLibrary(Unknown Source)
> gnu.io.RXTXPort.<clinit>(Unknown Source)
> java.lang.Class.runStaticInitializers(Unknown Source)
> com.fourhome.zwave.SerialComm.run(Unknown Source)
> java.lang.Thread.run(Unknown Source)
> java.lang.Thread.startup(Unknown Source)
>
>
> Even though that library file is there:
>
> # ls
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
>
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
> # cd /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/
> # ls -l
> -rw------- 1 0 0 94351 Sep 14 10:46 librxtxSerial.so
>
> I'm starting the bundles in the config.properties file at startup time
> (pasted below). I've also tried starting everything but the problematic
> zwave.jar bundle, and then starting that one interactively. When I do that,
> I get:
>
> -> install file:/usr/lib/fluid/plugins/zwave.jar
> ERROR: JarContent: Unable to create library directory.
> removing /var/lib/fluid/osgi-config/bundle15/bundle.id
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/bundle.id
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/bundle.location
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/bundle.location
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0
> rm ret 0
> removing /var/lib/fluid/osgi-config/bundle15
> rm ret 0
> org.osgi.framework.BundleException: Native library does not exist:
> native/linux/mips/librxtxSerial.so
> at org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(Unknown
> Source)
> at org.apache.felix.framework.BundleImpl.createModule(Unknown
> Source)
> at org.apache.felix.framework.BundleImpl.<init>(Unknown Source)
> at org.apache.felix.framework.Felix.installBundle(Unknown Source)
> at org.apache.felix.framework.Felix.installBundle(Unknown Source)
> at
> org.apache.felix.framework.BundleContextImpl.installBundle(Unknown Source)
> at org.apache.felix.shell.impl.InstallCommandImpl.install(Unknown
> Source)
> at org.apache.felix.shell.impl.InstallCommandImpl.execute(Unknown
> Source)
> at
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Unknown
> Source)
> at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Unknown
> Source)
> at java.lang.Thread.run(Unknown Source)
> at java.lang.Thread.startup(Unknown Source)
> org.osgi.framework.BundleException: Native library does not exist:
> native/linux/mips/librxtxSerial.so
>
> In particular, the line that says "ERROR: JarContent: Unable to create
> library directory." seems promising. When I do things this way, the bundle
> is never installed and the bundle directory is never created. But I don't
> know why.
>
> What I'm looking for is any advice on how to tease more information out of
> Felix about what the problem is with that library. Note that this setup
> works fine on at least three other embedded platforms as well as on my linux
> PC. Any help at all is very much appreciated, and I mean that. If there is
> any additional information that would help I can get it. I've pasted below
> some other misc. stuff.
>
> Thank you,
> Matt
>
>
> Start command:
> -----------------------------
> Starting fluid core with this command: 'cvm -Xmx8m
> -Djava.net.preferIPv4Stack=true -Dcore.data.dir=/var/lib/fluid
> -Dcore.lon.enable=false -Dcore.manufacturer.name=4Home
> -Dcore.model.number=CP2000 -Dcore.config.protect=true
> -Dcore.config.password=4444444444 -Dcore.config.user=4HDEFAULT
> -Dcore.net.interface=br0 -Dcore.zwave1.interface=/dev/tts/1
> -Dcore.logging.level=4 -Dcore.conf.file=/var/lib/fluid/fluid-core.conf
> -Dorg.osgi.framework.storage=/var/lib/fluid/osgi-config
> -Dfelix.config.properties=file:/var/lib/fluid/osgi-config/config.properties
> -jar lib/felix.jar'
>
> config.properties
> -----------------------------
> felix.log.level=4
> felix.auto.start.1= file:lib/commons.jar
> file:lib/org.apache.felix.configadmin-1.0.10.jar
> file:lib/org.apache.felix.http.jetty-1.0.1.jar
> file:lib/org.apache.felix.log-1.0.0.jar
> file:lib/org.apache.felix.shell-1.2.0.jar
> file:lib/org.apache.felix.shell.tui-1.2.0.jar file:lib/RXTXcomm.jar
> file:lib/upnplib.jar file:core.jar file:plugins/ipc.jar file:plugins/led.jar
> file:plugins/ndc.jar file:plugins/pgw.jar file:plugins/portmap.jar
> file:plugins/tweenagent.jar file:plugins/upnp.jar file:plugins/zwave.jar
> felix.service.urlhandlers=false
> org.apache.felix.http.nio=false
> org.ungoverned.osgi.bundle.https.enabled=false
>
> Manifest of the zwave.jar bundle:
> -----------------------------
> Ant-Version Apache Ant 1.7.1
> Bundle-Activator com.fourhome.zwave.ZWaveClient
> Bundle-ManifestVersion 2
> Bundle-Name 4Home ZWave Client
> Bundle-NativeCode
> native/linux/mips/librxtxSerial.so;osname=linux;processor=mips
> Bundle-SymbolicName ZWave
> Bundle-Version 3.1.4
> Created-By 14.0-b16 (Sun Microsystems Inc.)
> Import-Package com.fourhome.commons,
> org.osgi.framework;version="1.3.0"
> Manifest-Version 1.0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Cannot load native library
Posted by Chris Custine <ch...@gmail.com>.
I could be mistaken, but IIRC you can also get this error if the library is
linked against another lib that is missing. On linux you can usually figure
these out with ldd.
ldd -v
/var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
Not sure if you have that option on your device, but it might be worth a
try.
Chris
--
Chris Custine
FUSESource :: http://fusesource.com
My Blog :: http://blog.organicelement.com
Apache ServiceMix :: http://servicemix.apache.org
Apache Directory Server :: http://directory.apache.org
On Mon, Sep 14, 2009 at 5:13 PM, Matt Tennant <mt...@4home.com> wrote:
> Hi all,
>
> I have a problem that has me stumped, and I'm looking for any help I can
> get. I recently ported our company's java code to OSGi bundles, usually
> running in the Felix framework and embedded in a device with phoneME JVM.
> Everything works great except for a couple of issues, one of which is that
> on one of our devices the native libraries won't load. I get an error like
> this:
>
> Uncaught Exception in thread Serial Communications Thread:
> java.lang.UnsatisfiedLinkError Can't load
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
> java.lang.ClassLoader.loadLibraryInternal(Unknown Source)
> java.lang.ClassLoader.loadLibrary(Unknown Source)
> java.lang.Runtime.loadLibrary0(Unknown Source)
> java.lang.System.loadLibrary(Unknown Source)
> gnu.io.RXTXPort.<clinit>(Unknown Source)
> java.lang.Class.runStaticInitializers(Unknown Source)
> com.fourhome.zwave.SerialComm.run(Unknown Source)
> java.lang.Thread.run(Unknown Source)
> java.lang.Thread.startup(Unknown Source)
>
>
> Even though that library file is there:
>
> # ls
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
>
> /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/librxtxSerial.so
> # cd /var/lib/fluid/osgi-config/bundle9/version0.0/lib/native/linux/mips/
> # ls -l
> -rw------- 1 0 0 94351 Sep 14 10:46 librxtxSerial.so
>
> I'm starting the bundles in the config.properties file at startup time
> (pasted below). I've also tried starting everything but the problematic
> zwave.jar bundle, and then starting that one interactively. When I do that,
> I get:
>
> -> install file:/usr/lib/fluid/plugins/zwave.jar
> ERROR: JarContent: Unable to create library directory.
> removing /var/lib/fluid/osgi-config/bundle15/bundle.id
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/bundle.id
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/bundle.location
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/bundle.location
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/bundle.jar
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
> rm ret -1
> unlinking /var/lib/fluid/osgi-config/bundle15/version0.0/revision.location
> b 0
> removing /var/lib/fluid/osgi-config/bundle15/version0.0
> rm ret 0
> removing /var/lib/fluid/osgi-config/bundle15
> rm ret 0
> org.osgi.framework.BundleException: Native library does not exist:
> native/linux/mips/librxtxSerial.so
> at org.apache.felix.framework.searchpolicy.ModuleImpl.<init>(Unknown
> Source)
> at org.apache.felix.framework.BundleImpl.createModule(Unknown
> Source)
> at org.apache.felix.framework.BundleImpl.<init>(Unknown Source)
> at org.apache.felix.framework.Felix.installBundle(Unknown Source)
> at org.apache.felix.framework.Felix.installBundle(Unknown Source)
> at
> org.apache.felix.framework.BundleContextImpl.installBundle(Unknown Source)
> at org.apache.felix.shell.impl.InstallCommandImpl.install(Unknown
> Source)
> at org.apache.felix.shell.impl.InstallCommandImpl.execute(Unknown
> Source)
> at
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Unknown
> Source)
> at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Unknown
> Source)
> at java.lang.Thread.run(Unknown Source)
> at java.lang.Thread.startup(Unknown Source)
> org.osgi.framework.BundleException: Native library does not exist:
> native/linux/mips/librxtxSerial.so
>
> In particular, the line that says "ERROR: JarContent: Unable to create
> library directory." seems promising. When I do things this way, the bundle
> is never installed and the bundle directory is never created. But I don't
> know why.
>
> What I'm looking for is any advice on how to tease more information out of
> Felix about what the problem is with that library. Note that this setup
> works fine on at least three other embedded platforms as well as on my linux
> PC. Any help at all is very much appreciated, and I mean that. If there is
> any additional information that would help I can get it. I've pasted below
> some other misc. stuff.
>
> Thank you,
> Matt
>
>
> Start command:
> -----------------------------
> Starting fluid core with this command: 'cvm -Xmx8m
> -Djava.net.preferIPv4Stack=true -Dcore.data.dir=/var/lib/fluid
> -Dcore.lon.enable=false -Dcore.manufacturer.name=4Home
> -Dcore.model.number=CP2000 -Dcore.config.protect=true
> -Dcore.config.password=4444444444 -Dcore.config.user=4HDEFAULT
> -Dcore.net.interface=br0 -Dcore.zwave1.interface=/dev/tts/1
> -Dcore.logging.level=4 -Dcore.conf.file=/var/lib/fluid/fluid-core.conf
> -Dorg.osgi.framework.storage=/var/lib/fluid/osgi-config
> -Dfelix.config.properties=file:/var/lib/fluid/osgi-config/config.properties
> -jar lib/felix.jar'
>
> config.properties
> -----------------------------
> felix.log.level=4
> felix.auto.start.1= file:lib/commons.jar
> file:lib/org.apache.felix.configadmin-1.0.10.jar
> file:lib/org.apache.felix.http.jetty-1.0.1.jar
> file:lib/org.apache.felix.log-1.0.0.jar
> file:lib/org.apache.felix.shell-1.2.0.jar
> file:lib/org.apache.felix.shell.tui-1.2.0.jar file:lib/RXTXcomm.jar
> file:lib/upnplib.jar file:core.jar file:plugins/ipc.jar file:plugins/led.jar
> file:plugins/ndc.jar file:plugins/pgw.jar file:plugins/portmap.jar
> file:plugins/tweenagent.jar file:plugins/upnp.jar file:plugins/zwave.jar
> felix.service.urlhandlers=false
> org.apache.felix.http.nio=false
> org.ungoverned.osgi.bundle.https.enabled=false
>
> Manifest of the zwave.jar bundle:
> -----------------------------
> Ant-Version Apache Ant 1.7.1
> Bundle-Activator com.fourhome.zwave.ZWaveClient
> Bundle-ManifestVersion 2
> Bundle-Name 4Home ZWave Client
> Bundle-NativeCode
> native/linux/mips/librxtxSerial.so;osname=linux;processor=mips
> Bundle-SymbolicName ZWave
> Bundle-Version 3.1.4
> Created-By 14.0-b16 (Sun Microsystems Inc.)
> Import-Package com.fourhome.commons,
> org.osgi.framework;version="1.3.0"
> Manifest-Version 1.0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>