• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Web Application Class Loader and Weblogic

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 - 9.0.2.0.0"
Specification-Vendor: "Oracle Corporation" .
Implementation-Title: "ojdbc14.jar"
Implementation-Version: "Oracle JDBC Driver version - 9.0.2.0.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.

Email: wayoubi@etq.com
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Wasim Ayoubi
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

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.

I tried this and it is working fine

see link below for more details
http://e-docs.bea.com/wls/docs81/programming/classloading.html#1082452

http://e-docs.bea.com/wls/docs92/programming/classloading.html
[ December 07, 2006: Message edited by: Wasim Ayoubi ]
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic