Reputation: 1433
I am trying to load a jar at runtime, ojdbc14.jar
in this case.
The jar gets loaded properly, and I am also able to create a connection to the DB(oracle).
But whenever I try to do a connection.createStatement();
it gives me this Exception
$Exception in thread "Thread-24" java.lang.IllegalAccessError: tried to access method oracle.jdbc.driver.OracleSql.(Loracle/jdbc/driver/DBConversion;)V from class oracle.jdbc.driver.OracleStatement at oracle.jdbc.driver.OracleStatement.(OracleStatement.java:641) at oracle.jdbc.driver.T4CStatement.(T4CStatement.java:702) at oracle.jdbc.driver.T4CDriverExtension.allocateStatement(T4CDriverExtension.java:50) at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:584) at oracle.jdbc.driver.PhysicalConnection.createStatement(PhysicalConnection.java:550) at genInstaller.Controller.MetadataScriptManager.checkTableExistence(MetadataScriptManager.java:450) ... ... ...
Edit:
String dbDriverLocn = //location of ojdbc14.jar
String strDBDriverURL = "jdbc:oracle:thin:@frewper:1521:ORCL"
String strDBUserName = "frewper"
String strDBUserPassword = "frewper"
new LoadClassTest().callToLoad(dbDriverLocn);
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(strDBDriverURL,strDBUserName,strDBUserPassword);
Statement st = conn.createStatement();
//Exception occurs here
} catch (SQLException e)
{
e.printStackTrace();
}
Upvotes: 1
Views: 1943
Reputation: 68962
According to this thread it seems that you have compiled against an older version of the jdbc driver and during run time you try to access methods of no longer visible classes, see Oracles Announcement: oracle.jdbc.driver package desupport .
Upvotes: 2