I am working on J2EE project that I am trying to deploy on weblogic8.1 and 9.2 servers; this project supports multi-database vendors, oracle is one of the supported databases.
In this project we use the following oracle jdbc driver by placing it�s jar file into WEB-INF\lib folder of our web application
�Specification-Title: "Oracle JDBC driver classes for use with JDK1.4" Specification-Version: "Oracle JDBC Driver version - 220.127.116.11.0" Specification-Vendor: "Oracle Corporation" . Implementation-Title: "ojdbc14.jar" Implementation-Version: "Oracle JDBC Driver version - 18.104.22.168.0" Implementation-Vendor: "Oracle Corporation" Implementation-Time: "Thu Apr 25 23:14:02 2002"�
My problem is as follows:
Weblogic server 8.1 and 9.2 uses the following oracle jdbc driver by default
Specification-Title: Oracle JDBC driver classes for use with JDK14 Sealed: true Created-By: 1.4.2_08 (Sun Microsystems Inc.) Implementation-Title: ojdbc14.jar Specification-Vendor: Oracle Corporation Specification-Version: Oracle JDBC Driver version - "10.2.0.2.0" Implementation-Version: Oracle JDBC Driver version - "10.2.0.2.0" Implementation-Vendor: Oracle Corporation Implementation-Time: Tue Jan 24 08:55:21 2006
the driver I am using in my project which is 9.0.2 reads dates from database as java.sql.Timestamp objects but the bundled 10g jdbc driver reads dates as java.sql.Date objects which make my code not to run and throws ClassCastException exceptions.
I want to figure how to make my application uses the ojdbc driver in the WEB-INF/lib folder, as I know from J2EE specs every web application has it's own classloader that loads classes by order and it starts loading from the WEB-INF/lib folder. but it seems loading the 10g driver classes first.
I can make a work around by creating managed server and modify the startWLS.cmd file by adding the jar file I want in front of the classpath but this may be not applicable for customers who do not want to create a new managed server! also I have customers who have other third party application which run using oracle 10g driver and the customer wants these applications to still using the weblogic OTB 10g driver.
What I want exactly, how to make a specific web application deployed on Weblogic server uses a specific driver jar file without affecting the server classpath or any other third part applications deployed on the same server instance.
How are you obtaining your database connections? If you are configuring it through the Weblogic console and getting the connection through JNDI, I would assume that Weblogic would use the classes in the system classpath, which is not what you want. If you register the driver name in your code and obtain the connection through a call to DriverManager.getConnection(), I would assume that you would get the classes in your web application's classpath. I've never tried it.
The Jar file is placed into the WEB-INF/lib folder and I am using DriverManager.getConnection to obtain connection to the database.
I posted the this question to BEA support and got a great answer from them, I shall provide a special weblogic deployment descriptor (next to web.xml) which is weblogic-web.xml and use a custom weblogic deployment tag to prefer using classes from the WEB-INF/lib folder.