java.lang.IllegalAccessException: Class <class name> can not access a member of class oracle.jdbc.driver.OraclePreparedStatementWrapper with modifiers "public" After Upgrading to JDBC 11g

(Doc ID 1153487.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version: 11.1.0.6 and later   [Release: 11.1 and later ]
Information in this document applies to any platform.

Symptoms

When using ojdbc14.jar (JDBC 10g driver) , J2EE application works fine.
But, after upgrading to JDBC driver 11g (ojdbc6.jar), the application fails with an illegal access exception.
The same error reproduces from a JDBC standalone application.

The error is:


java.lang.IllegalAccessException: Class framework.utilities.db.MapToDatabase can not access a member of class oracle.jdbc.driver.OraclePreparedStatementWrapper with modifiers "public"

The code where the error occur is :


ps = con.prepareStatement(query);
...
Class valueClass = value.getClass();
Class[] setMethodSignature = { int.class, valueClass };
Object[] setMethodParams = { Integer.valueOf(fieldIndex), value };
String setMethodName = "set" + valueClass.getName().substring(valueClass.getName().lastIndexOf(".")+1);
Method setMethod = ps.getClass().getMethod(setMethodName, setMethodSignature);
setMethod.invoke(ps, setMethodParams); ***



Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms