Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Tomcat and webapplication-specific java.library.path

Tomcat and webapplication-specific java.library.path

2004-01-16       - By Erik Winl�f

 Back

I have a problem with Tomcat and the java-library.path.
(My problem isn't Oracle-specific but it is when I use Oracle that problem
appears since Oracle uses the java.library.path)

What I have managed to do:
Oracle JDBC with works fine if I:
- put ojdbc14.jar in ${CATALINA_HOME}/common/lib
- set ORACLE_HOME to the correct directory
- set LD_LIBRARY_PATH (java.library.path) to include the directory with
  the needed .so-file

However this is not exactly what I wan't to do. Instead of setting the
variables in the shell I want to set them from a Java-class when it is
invoked by Tomcat.

So I set ORACLE_HOME to the same directory as above and include the directory
with the .so-file in the LD_LIBRARY_PATH by doing this:

System.out.println("JLP  =" + System.getProperty("java.library.path");
System.out.println("OH   =" + System.getProperty("ORACLE_HOME");

System.setProperty("ORACLE_HOME", dbHomePath);
String jlp = java.lang.System Source code of java.lang.System("java.library.path");
System.setProperty("java.library.path", dbLibraryPath + ":" + jlp);

System.out.println("JLP2 =" + System.getProperty("java.library.path");
System.out.println("OH2  =" + System.getProperty("ORACLE_HOME");

String dsJNDIName = "java:/comp/env/jdbc/orgdbDataSource";
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup(dsJNDIName);

When I print these variables they look exactly as I want them to look,
just like they did when everything worked (the top of the mail
"What I have managed to do"). They look like this:

JLP  =null
OH   =/appl/oracle/product/9.2.0/

JLP2 =/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/lib/i386/client:/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/lib/i386:
/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/../lib/i386:/appl/mqm/java/lib/:/opt/mqm/java/lib
OH2  =/appl/oracle/product/9.2.0/lib/:/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/lib/i386/client:
/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/lib/i386:/opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/../lib/i386:/appl/mqm
/java/lib/:/opt/mqm/java/lib

(Notice the change with /opt/sun-jdk-1 (See http://jdk-1.ora-code.com).4.2/jre/lib/i386/client in the
start of the path)

My thinking is this (based on what I have read about the ClassLoader):
http://jakarta.apache.org/tomcat/tomcat-5 (See http://cat-5.ora-code.com).0-doc/class-loader-howto.html

Since the ojdbc14.jar is placed in /common/lib, the jar doesn't
include my webapplication-spcific java.library.path since it is supposed
to be shared by all webapplications. However, if this is the case, it is
kind of strange since it is my webapplication that uses and loads ojdbc14
and NOT ojdbc14 that uses my webapplication. Therefore I think that ojdbc14
should
use my java.library.path.

This is the error I get by the way:

java.lang.UnsatisfiedLinkError Source code of java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
  java.lang.ClassLoader Source code of java.lang.ClassLoader(ClassLoader.java:1491)
  java.lang.Runtime Source code of java.lang.Runtime(Runtime.java:788)
  java.lang.System Source code of java.lang.System(System.java:834)
  oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
  oracle.jdbc.driver.OracleConnection.(OracleConnection.java:346)
       oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java
:468)
  oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)  
       org.apache.commons.dbcp.DriverConnectionFactory Source code of org.apache.commons.dbcp.DriverConnectionFactory
(DriverConnectionFactory.java:82)  
  org.apache.commons.dbcp.PoolableConnectionFactory Source code of org.apache.commons.dbcp.PoolableConnectionFactory
(PoolableConnectionFactory.java:300)  
  org.apache.commons.dbcp.BasicDataSource Source code of org.apache.commons.dbcp.BasicDataSource
(BasicDataSource.java:838)  
  org.apache.commons.dbcp.BasicDataSource Source code of org.apache.commons.dbcp.BasicDataSource(BasicDataSource.java
:821)  
  org.apache.commons.dbcp.BasicDataSource Source code of org.apache.commons.dbcp.BasicDataSource(BasicDataSource.java:518)
  gu.orgdb.orgobj.Database.getConnection(Database.java:148)
  gu.orgdb.orgobj.UserSession.getConnection(UserSession.java:245)
  gu.orgdb.orgobj.Database.loadOrgUnitsByType(Database.java:2243)  
  gu.orgdb.orgobj.OrgObjectManager.viewOrgUnitsByType(OrgObjectManager.java:218)
  gu.orgdb.orgobj.OrgUnit.getUniversity(OrgUnit.java:264)
  gu.orgdb.util.ImportOrganization.doImport(ImportOrganization.java:46)
  gu.orgdb.web.OrgDBServlet.init(OrgDBServlet.java:72)
  org.apache.catalina.valves.ErrorReportValve Source code of org.apache.catalina.valves.ErrorReportValve(ErrorReportValve.java:164)
  org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
  org.apache.coyote.http11.Http11Processor Source code of org.apache.coyote.http11.Http11Processor(Http11Processor.java:805)
  org.apache.coyote.http11.Http11Protocol Source code of org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler
.processConnection(Http11Protocol.java:696)
  org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
  org.apache.tomcat.util.threads.ThreadPool Source code of org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java
:677)
  java.lang.Thread Source code of java.lang.Thread(Thread.java:534)

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)