Thursday, 28 July 2011

Weblogic and different version Oracle JDBC driver Problem

When trying to configure a new JDBC Datasource in Weblogic the following error was shown in the console: java.lang.ArrayIndexOutOfBoundsException: 7

The Weblogic server log shows the following trace:
01####       <> <>    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:989)
02    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
03    at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:508)
04    at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:203)
05    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
06    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
07    at com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:505)
08    at com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(CreateJDBCDataSource.java:458)
09    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
11    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
12    at java.lang.reflect.Method.invoke(Method.java:597)
13    ....
After some debugging the source of the problem was an old Oracle Database version (8.1.7) used in the test environment. Apparantly the combination with Weblogic 10.3.3 & Oracle JDBC driver (ojdbc6.jar) is not supported/allowed/working. This old database version was not used in the new Acceptance and Production environment so we needed a simple work-around.
We decided to try and use an old version of the ojdbc driver (1.4) instead of the default version (6).
So in our setDomainEnv.cmd we defined: set PRE_CLASSPATH=/oracle/library/ojdbc14.jar
As we had a dedicated Weblogic Test Domain we could configure it like this for the whole domain.
After restarting the Managed Server we could see in the logging that the driver has been loaded first:
java.class.path = /oracle/library/ojdbc14.jar;/oracle/ofmw11113/patch_wls1033/…………
And after restart configuring the JDBC Datasource succeeded.


Remarks:
  • Remember that this solution above impacts all Oracle JDBC datasources on the Managed Server
  • Oracle does not(!) support the use of ojdbc14.jar in an environment with Java version 6 or later.
  • However ojdbc14 should work just fine, certainly for us as a work-around. The primary differences between 1.4 and newer versions as 6 is that newer versions support new features of the JDBC API and Oracle Database.

No comments:

Post a Comment