1 Reply Latest reply on Apr 27, 2015 2:13 AM by Philippe Marschall

    JBoss7-UnsatisfiedLinkError: Native Library dll already loaded in another classloader

    Fanny C Newbie

      Hi everybody,

      I'm using JBoss 7 for my webapp and I have several problem using ojdbc7 as jboss module. Here my configuration:

       

      ---module.xml---

      <module xmlns="urn:jboss:module:1.0" name="com.oracle.jdbc">

        <resources>

        <resource-root path="ojdbc7.jar"/>

        </resources>

        <dependencies>

        <module name="javax.api"/>

        <module name="javax.transaction.api"/>

        </dependencies>

      </module>

       

      ---standalone.xml---

      ...

      <datasource jta="true" jndi-name="java:jboss/datasources/ds" pool-name="ds" enabled="true" use-java-context="true" use-ccm="true">

        <connection-url>jdbc:oracle:oci:@db</connection-url>

        <driver>OracleJDBCDriver</driver>

        <security>

        <user-name>user</user-name>

        <password>psw</password>

        </security>

      </datasource>

      <drivers>

        <driver name="OracleJDBCDriver" module="com.oracle.jdbc">

        <xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>

        </driver>

      </drivers>

      ...

       

      In my Java class, I want to instantiate OracleOCIConnectionPool because i want to connect to oracle db with different settings respect to those defining in standalone.xml (i have two different users that access to db).

      When I try to use OracleOCIConnectionPool in my webapp, I have the following error:

       

       

      16:29:16,309 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/web]] (MSC service thread 1-8) Exception sending context initialized event to listener instance of class com.test.Listener: java.lang.UnsatisfiedLinkError: Native Library C:\app\client\mypc\12.1.0\dbhome_1\bin\ocijdbc12.dll already loaded in another classloader

        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1931) [rt.jar:1.7.0_76]

        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890) [rt.jar:1.7.0_76]

        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880) [rt.jar:1.7.0_76]

        at java.lang.Runtime.loadLibrary0(Runtime.java:849) [rt.jar:1.7.0_76]

        at java.lang.System.loadLibrary(System.java:1088) [rt.jar:1.7.0_76]

        at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:4123) [ojdbc7.jar:12.1.0.2.0]

        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_76]

        at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:4119) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:312) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:54) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:573) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.pool.OracleOCIConnectionPool.createConnectionPool(OracleOCIConnectionPool.java:990) [ojdbc7.jar:12.1.0.2.0]

        at oracle.jdbc.pool.OracleOCIConnectionPool.setPoolConfig(OracleOCIConnectionPool.java:549) [ojdbc7.jar:12.1.0.2.0]

        at com.test.load.DSDb.<init>(DSDb.java:118) [ejb-0.0.1-SNAPSHOT.jar:]

        at com.test.load.DSDb.crea(DSDb.java:211) [ejb-0.0.1-SNAPSHOT.jar:]

        ....

       

       

      I don't know why. Can someone help me, please?