1 Reply Latest reply: Apr 4, 2012 7:57 AM by Thomas S RSS

    UnsatisfiedLinkError: Native Library ...so already loaded in another classloader

    Thomas S Newbie

      Hello

       

      I'm using JBoss AS 7.1.0.Final and is developing under Eclipse Indigo.

       

      I have multiple jar projects, a utility project and a war project gathered under a .ear project.

      I am using the jpathwatch (http://jpathwatch.wordpress.com/) lib and this is added to the .ear project to be used on of the jar project.

      I'm having some problems with redeploying the .ear.

       

      The structure is like this:

      - CM_project.ear

         |-- /lib

         |    |-- jpathwatch-0-95.jar

         |-- /modules

         |    |-- ContentWatcher.jar (Uses the jpathwatch lib)

        |    |-- Second.jar

        |    |-- Third.jar

       

      Deploying works and the application is working as expected. Good!

      Undeploying is also working.

      Deploying again -> Error! Exception appended.

       

      How am I supposed to deploy the jpathwatch?

      Should I unload it at predestroy somehow?

       

      Should I create a module for the jpathwatch instead?

      I think this could be the way out, but I tried and it didn't find some of the classes in jpathwatch

      -> Could someone confirm that this is right way of referening a native library?

       

      Please help

       

      Thomas

       

      11:55:33,528 ERROR [stderr] (MSC service thread 1-2) java.lang.UnsatisfiedLinkError: Native Library /tmp/jpathwatch-nativelib-v-0-95-libjpathwatch-native.so already loaded in another classloader

      11:55:33,532 ERROR [stderr] (MSC service thread 1-2)           at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1715)

      11:55:33,538 ERROR [stderr] (MSC service thread 1-2)           at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1646)

      11:55:33,542 ERROR [stderr] (MSC service thread 1-2)           at java.lang.Runtime.load0(Runtime.java:787)

      11:55:33,542 ERROR [stderr] (MSC service thread 1-2)           at java.lang.System.load(System.java:1022)

      11:55:33,544 ERROR [stderr] (MSC service thread 1-2)           at name.pachler.nio.file.impl.NativeLibLoader.extractAndLoadLibrary(NativeLibLoader.java:407)

      11:55:33,545 ERROR [stderr] (MSC service thread 1-2)           at name.pachler.nio.file.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:257)

      11:55:33,551 ERROR [stderr] (MSC service thread 1-2)           at name.pachler.nio.file.impl.LinuxPathWatchService.<clinit>(LinuxPathWatchService.java:105)

      11:55:33,555 ERROR [stderr] (MSC service thread 1-2)           at name.pachler.nio.file.ext.Bootstrapper.newWatchService(Bootstrapper.java:80)

      11:55:33,556 ERROR [stderr] (MSC service thread 1-2)           at name.pachler.nio.file.FileSystems$1.newWatchService(FileSystems.java:40)

      ...

      11:55:33,568 ERROR [stderr] (MSC service thread 1-2)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      11:55:33,577 ERROR [stderr] (MSC service thread 1-2)           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      11:55:33,578 ERROR [stderr] (MSC service thread 1-2)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      11:55:33,579 ERROR [stderr] (MSC service thread 1-2)           at java.lang.reflect.Method.invoke(Method.java:616)

      11:55:33,582 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130)

      11:55:33,584 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,590 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      11:55:33,591 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,598 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)

      11:55:33,599 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,600 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112)

      11:55:33,608 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,613 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      11:55:33,614 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,615 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95)

      11:55:33,617 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,622 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      11:55:33,634 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,635 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      11:55:33,645 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,653 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)

      11:55:33,659 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:333)

      11:55:33,660 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:56)

      11:55:33,662 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,663 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      11:55:33,674 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,675 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      11:55:33,676 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      11:55:33,677 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      11:55:33,678 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)

      11:55:33,690 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85)

      11:55:33,691 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:113)

      11:55:33,699 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:127)

      11:55:33,703 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)

      11:55:33,710 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

      11:55:33,716 ERROR [stderr] (MSC service thread 1-2)           at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

      11:55:33,724 ERROR [stderr] (MSC service thread 1-2)           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

      11:55:33,725 ERROR [stderr] (MSC service thread 1-2)           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

      11:55:33,726 ERROR [stderr] (MSC service thread 1-2)           at java.lang.Thread.run(Thread.java:679)

       

       


        • 1. Re: UnsatisfiedLinkError: Native Library ...so already loaded in another classloader
          Thomas S Newbie

          Hello again

           

          Should I create a module for the jpathwatch instead?

          I think this could be the way out, but I tried and it didn't find some of the classes in jpathwatch

          -> Could someone confirm that this is right way of referening a native library?

          Just cleared my head and give it try with the module way again. And now it works!

           

          To others (and myself):

          1. Make the directory path in the JBoss modules folder:

               cd $JBOSS_HOME/modules

               mkdir -p name/pachler/nio/file/main

               cd !$

           

          2. Copy the library to the folder

               cp path/to/lib/jpathwatch-0-95.jar .

           

          3. Create the module.xml

               vi module.xml

               Add the following to the module:

          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.1" name="name.pachler.nio.file">

              <resources>

                  <resource-root path="jpathwatch-0-95.jar"/>

              </resources>

              <dependencies>

              </dependencies>

          </module>

           

          Now remove the reference under the ear and just put it in the build path of the .jar project which needs it.

           

          Regards

          Thomas