title: Using Native Library in Spring With JBOSS
body: <p>In my application I'm using <code>Jnetpcap</code> native libraries. The native libraries are loaded using a <code>static</code> block in the <code>jar</code> itself.</p>
  
  <p>When I'm loading the application freshly into <code>JBOSS</code> after start, it works fine. </p>
  
  <p>Once I do any redeployment without restarting <code>JBOSS</code>, the application isn't able to register the library and throws <code>UnsatisfiedLinkError</code>.</p>
  
  <p>Again, if I restart the JBOSS, it works fine.</p>
  
  <p>JBoss Version: JBoss EAP 6.2.0.GA</p>
  
  <p>Libraries are at classpath in Windows, and \usr\lib in linux.</p>
  
  <p>Stack trace:</p>
  
  <blockquote>
    <p>01:41:48,829 ERROR [org.springframework.batch.core.step.AbstractStep]
    (pool-6-thread-1) Encountered an error executing the step:
    java.lang.UnsatisfiedLinkError:
    com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J    at
    com.slytechs.library.NativeLibrary.dlopen(Native Method)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.NativeLibrary.(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.JNILibrary.(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.JNILibrary.register(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.JNILibrary.register(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    com.slytechs.library.JNILibrary.register(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]    at
    org.jnetpcap.Pcap.(Unknown Source)
    [jnetpcap-1.4.r1425.jar:1.4.r1425]</p>
  </blockquote>