views:

74

answers:

2

Hello,

I use weblogic 10. Its provide an Oracle JDBC driver 10.2.0.2 (in the server/lib on weblogic home).

Actually someone at work put a long time ago a 10.2.0.3 driver in instance libext folder.

But in production we got a jdbc driver stack (nullpointer :O) and by reverse engineering it seems we are using driver 10.2.0.2.

We know that we could change the driver in the server/lib of weblogic but i want to understand.

Isn't libext supposed to override server libs like META-INF libs override libext?

By the way we are in a strange situation: - We have 2 EAR, and for the exact same treatment in those 2, one will sometime throw the oracle driver nullpointer while the other doesn't - I wonder if one ear isn't using 10.2.0.2 while the other is using 10.2.0.3 (i saw a bug fixed that could fit to our problem for this version). - I need to look better but at first sight both ear use the exact same datasource set in weblogic JNDI resources

Any idea?

+1  A: 

No one should be putting anything into the lib/ext directory, especially not JDBC driver JARs. That directory is for library extensions. I'd remove that JAR from lib/ext immediately.

As you say, if the 10.2.0.3 version is a bug fix, the correct place to put it would be server/lib, not lib/ext.

Two EARs means two separate servers or two different ports? I'm not sure why WebLogic would pick one driver up over the other for the same configuration.

duffymo
Actually i saw in the release notes of 10.2.0.3 a bug fixed:4688156 NullPointerException possible if network error occurs-> i think it's what we got...Also Weblogic doc itself sais that to update the driver we can replace the file in server/libI don't know at all why it would use one driver for an ear and another for the other... It's the only thing i found that could explain why a common treatment (initializing a translation cache) would work with one ear and not the other (about 40% failure on application startup)...
Sebastien Lorber
But actually my question wasn't to know if it's a good practice to put jdbc driver in libext but if it should override the weblogic provided oracle jdbc driver :)
Sebastien Lorber
I think you have your answer: "Sometimes". It's not a very satisfactory answer, in my view. Remove the JAR from lib/ext - you shouldn't be putting anything there except extensions from Sun. It wasn't meant to be a crutch for people who didn't understand CLASSPATH or thought they were being clever.
duffymo
+1  A: 

As @duffymo and Oracle docs state: http://download.oracle.com/docs/cd/E11035_01/wls100/jdbc_admin/third_party_drivers.html#wp1048361 the driver location should be server/lib.

Can you run this from a JSP on each EAR - this should give you the jar file from where the driver is loaded.

try {
  String candidate = "oracle.jdbc.driver.OracleDriver";
  Class clazz = Class.forName(candidate);
  java.security.ProtectionDomain dom = clazz.getProtectionDomain();
  java.security.CodeSource cs = dom.getCodeSource();
  java.net.URL url = cs.getLocation();
  out.println("<TITLE>" + candidate + "</TITLE></head><body>");
  out.println("Path for " + candidate + " = " + url.getFile());
} catch (Exception t) {
  t.printStackTrace(response.getWriter());
}
JoseK