Link to home
Start Free TrialLog in
Avatar of ezrael
ezrael

asked on

Native Library ...\ocijdbc9.dll already loaded in another classloader

Hi,
from netbeans I've build a very simple jsp page that does nothing but connect to a db (using oci) and then disconnect. Sometimes it hangs saying the things in the question title... what should I do?

thx.
Avatar of bloodredsun
bloodredsun
Flag of Australia image

If you are using an old version of java (< 1.4)This is a known bug of java and will not be fixed, see here http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4225434.

You could try making the loading static or using the thin driver which does not have the native dependency.
Avatar of ezrael
ezrael

ASKER

I'm using 1.5...  what is the loading static?
I also have tried with thin driver, but it isn't able to establish connection between my server and my client... dunno why.
Avatar of ezrael

ASKER

perhaps I simply have to shut down something when I leave the page?
I do only conn.clos(), perhaps the library need something else to do?
Avatar of ezrael

ASKER

IT COULD BE AN ANSWER: I get the error after the application hangs for some other reason, maybe netbeans is unable to unload the library/close the connection and so the library remains loaded in memory...

...could it be an answer?

ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ezrael

ASKER

I load the library doing this:

Class.forName("oracle.jdbc.driver.OracleDriver");

should I try with

static {
            Class.forName("oracle.jdbc.driver.OracleDriver");
}

?

thx!
yep, either that (see here http://www.developer.com/java/other/article.php/2238491) or put it in the jspInit() method as I described above
Avatar of ezrael

ASKER

ok, it runs with static method, but this is only a turnaround for making some tests on connections... until I'll be able to connect via a dbcp! could you help?
I've an open question here:

https://www.experts-exchange.com/questions/21479466/Cannot-create-JDBC-driver-of-class-''-for-connect-URL-'null'.html

Thank you so much!
Okay, thanks and I'll have a look