You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Filipe David Manana <fd...@ieee.org> on 2008/01/10 13:22:07 UTC

Tomcat 5.5 and loading of native libraries

Hi,

I am using Tomcat 5.5.23 and I have a webapp which uses a library (more
specifically, Oracle's JDBC) that loads a native library on my system (
libocijdbc10.so ).
Whenever I redeploy my webapp into tomcat, I get the exception
java.lang.UnsatisfiedLinkError, since the native library was already loaded
before by another class loader. By what I understand, tomcat uses a
different class loader for each webapp (including new versions of existing
ones). Is there anyway to force tomcat to use the same class loader for all
webapps (or for new versions of existing ones) ?

The details of the exception:

java.lang.UnsatisfiedLinkError: Native Library
/usr/lib/oracle/10.2.0.3/client/lib/libocijdbc10.so already loaded in
another classloader
	java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1716)
	java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
	java.lang.Runtime.loadLibrary0(Runtime.java:822)
	java.lang.System.loadLibrary(System.java:993)
	oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3135)


Thanks

-- 
Filipe David Manana,
fdmanana@ieee.org

Obvious facts are like secrets to those not trained to see them.

Re: Tomcat 5.5 and loading of native libraries

Posted by Filipe David Manana <fd...@ieee.org>.
That was it.
I had ojdbc14.jar in the WAR archive.

I just moved it into CATALINA_HOME/common/lib/ and it works now :)

By the way, is any of you using plain Oracle JDBC or with an ORM?

On 1/10/08, Wesley Schwengle <we...@orange-ftgroup.com> wrote:
>
> On 10.01.08 13:22 Filipe David Manana wrote:
>
> > I am using Tomcat 5.5.23 and I have a webapp which uses a library (more
> > specifically, Oracle's JDBC) that loads a native library on my system (
> > libocijdbc10.so ).
>
> Is did you put the library files in your war file?
>
> I experienced similair problems when we wanted to use C libraries for
> Remedy. We ended up removing the library files from the war file and
> put them in /path/to/lib and added this path to LD_LIBRARY_PATH and
> added set the following param when starting tomcat:
>
>    -Djava.library.path=/path/to/lib
>
> This resolved our unsatisfiedlink error. Hope this helps.
>
> Cheers,
> Wesley
>
>
> --
> Orange Nederland Breedband BV, http://www.orange.nl & http://www.equant.nl&
> http://www.euronet.nl
> Wesley Schwengle, System Administrator, IT Operations - Business Systems
> Muiderstraat 1, P.o. BOX 10241 , 1001 EE Amsterdam
> T:+31 (0)20 535 52 55, F:+31 (0)20 535 57 49
>



-- 
Filipe David Manana,
fdmanana@ieee.org

Obvious facts are like secrets to those not trained to see them.

Re: Tomcat 5.5 and loading of native libraries

Posted by Wesley Schwengle <we...@orange-ftgroup.com>.
On 10.01.08 13:22 Filipe David Manana wrote:

> I am using Tomcat 5.5.23 and I have a webapp which uses a library (more
> specifically, Oracle's JDBC) that loads a native library on my system (
> libocijdbc10.so ).

Is did you put the library files in your war file?

I experienced similair problems when we wanted to use C libraries for
Remedy. We ended up removing the library files from the war file and 
put them in /path/to/lib and added this path to LD_LIBRARY_PATH and 
added set the following param when starting tomcat:

   -Djava.library.path=/path/to/lib

This resolved our unsatisfiedlink error. Hope this helps.

Cheers,
Wesley


-- 
Orange Nederland Breedband BV, http://www.orange.nl & http://www.equant.nl & http://www.euronet.nl
Wesley Schwengle, System Administrator, IT Operations - Business Systems
Muiderstraat 1, P.o. BOX 10241 , 1001 EE Amsterdam
T:+31 (0)20 535 52 55, F:+31 (0)20 535 57 49

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 5.5 and loading of native libraries

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: fdmanana@gmail.com [mailto:fdmanana@gmail.com] On 
> To: Tomcat Users List
> Subject: Tomcat 5.5 and loading of native libraries
> 
> Is there anyway to force tomcat to use the same class 
> loader for all webapps

Put the JDBC driver jar in common/lib, rather than in each webapp's
WEB-INF/lib.  This will likely require DB connections to be shared
across webapps, but also allows Tomcat to manage the connection pooling.

An alternative is to use Oracle's type 4 driver, which has no native
code.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org