• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[SOLVED] Oracle OCI library already loaded in another classloader exception

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I hope this is the right place to post..
I've got a web application that use Oracle OCI driver for connecting to an Oracle Database.
This application use Realm with OCI driver for servlet authentication and ALSO (I know the problem is here) is used again from the application to read some data from the same database.
With this situation the application throw a Servlet Exception: Native Library "already loaded in another classloader".
The oci library "ojdbc14.jar" is in the common/lib directory is it the right place?
Where should I put it?

The same application with the THIN driver doesn't make problem but I can't use it and I must use OCI driver instead.
Any solution to this problem?
Thanks you in advance


This is the tomcat error message:

org.apache.jasper.JasperException: Native Library /usr/lib/oracle/10.2.0.3/client/lib/libocijdbc10.so already loaded in another classloader
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: Native Library /usr/lib/oracle/10.2.0.3/client/lib/libocijdbc10.so already loaded in another classloader
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.seltronco_jsp._jspService(seltronco_jsp.java:286)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

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)
java.security.AccessController.doPrivileged(Native Method)
oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3131)
oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your classpath is a mess.
Remove all duplicate JAR files.
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:Your classpath is a mess.
Remove all duplicate JAR files.



Thanks you for the answer.
So the library must be in common/lib directory of tomcat.

I'm using eclipse, and I put the library in the build path for compile the application (it points on $TOMCAT_HOME/common/lib/ojdbc14.jar").
Is this wrong?

Thanks in advance
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrea De Gaetano wrote:
So the library must be in common/lib directory of tomcat.

To be more precise: in the classpath.


I'm using eclipse, and I put the library in the build path for compile the application (it points on $TOMCAT_HOME/common/lib/ojdbc14.jar").
Is this wrong?

Thanks in advance

Apparently. You just need to associate Tomcat with the web project. Nothing more. No changes in build path. Eclipse itself perfectly knows what to do with Tomcat.
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:

Andrea De Gaetano wrote:
So the library must be in common/lib directory of tomcat.

To be more precise: in the classpath.



you mean that:
- I have to change the classpath (or catalina.sh)
or
- common/lib is in tomcat classpath , so the library is too
?

Thanks you again
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The library must essentially be placed in the classpath.
In case of Tomcat, under each the /common/lib folder is covered by the classpath.
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
one month past but I don't go so far from the last time I wrote here
Thanks to Bauke Scholtz for his support.

I'm investigating again on the problem and I found that is present only with Realm e OCI driver.
Now I have a new Tomcat enviroment, clean, with only one application installed.
This application use JDBCRealm with Oracle driver for jdbc for authentication and it display simple jsp page containing text messagges..

Again everything works with the "Thin" Driver, instead with OCI driver, after the login procedure the java virtual machine crash with some memory dump messagges...
The ojdbc14.jar is in $TOMCAT_HOME/common/lib
The ORACLE_HOME is set.
I don't use other library ...

Any suggestion ?
Thanks you
 
Andrea De Gaetano
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Finally I've found the solution!
There was two problem:
- in my enviroment Realm+Oracle OCI miserally crash! I don't know why, I will investigate but it's not releated with this topic and I don't have problem in another enviroment that I can use! I produced a first example program whit only realm and oci for test it.
- like stupid , I forgot to remove ojdbc14.jar from a directory INSIDE the war. I thought this wasn't a problem to have inside a subdirectory a jar...

At least, thanks again Bauke Scholtz.

You can close this topic.
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic