• Post Reply Bookmark Topic Watch Topic
  • New Topic

Oracle-JDBC dll file  RSS feed

 
rajee bharara
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
In our companey intranet , we have 6 java application running over same tomcat context. There is two EJB application whose EJB components r deployed on weblogic and web componets r in Tomcat and one application is using oracle thin driver and other 2 using sql server oci driver. B4 there is no problem.but we have created a new application using both sql server and oracle connection, as ocijdbc.dll file is already loaded in memory , its not creating or loading another dll file, i even tried to unregisted the driver but there is no sucess, is it possible to unload the dll file in memory or anything which would help???the exception cming is :

javax.servlet.ServletException: Native Library D:\oracle\ora90\BIN\ocijdbc9.dll already loaded in another classloader
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471)
org.apache.jsp.webPages.leaveManager_jsp._jspService(leaveManager_jsp.java:924)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:268)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:258)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:205)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.UnsatisfiedLinkError: Native Library D:\oracle\ora90\BIN\ocijdbc9.dll already loaded in another classloader
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1551)
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
java.lang.Runtime.loadLibrary0(Runtime.java:788)
java.lang.System.loadLibrary(System.java:834)
oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:294)
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:307)
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
java.sql.DriverManager.getConnection(DriverManager.java:512)
java.sql.DriverManager.getConnection(DriverManager.java:171)
com.xavient.xavLeaveManager.DBConnection.getConn(DBConnection.java:167)
com.xavient.xavLeaveManager.LeaveManagerAction.getUserFullName(LeaveManagerAction.java:299)
org.apache.jsp.webPages.leaveManager_jsp._jspService(leaveManager_jsp.java:77)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:268)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:258)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:205)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

please help me out as soon as possible. suggestion r welcome.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you are using the OCI driver, which uses JNI.
You can't load a JNI resource multiple times in the same JVM.
You have three options:

1. Stop using the OCI driver, use the thin one instead.

2. Take the driver library out of your WEB-INF/lib directories
and move it into shared/lib instead.

3. (A refinement of 2) create a JMX component that will
manage the driver for Tomcat.

#3 is more hassle than you probably want, but it is why
Weblogic isn't complaining.
 
Alex Deygan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Follow this link to unload dll:

http://www.codethesis.com/blog/unload-java-jni-dll

I tried it with my web application running on Tomcat, and it works!

Briefly, I call System.loadLibrary from the class which is loaded by my custom class loader using reflection. This class is then removed by garbage collector.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!