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.
ezraelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bloodredsunCommented:
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.
ezraelAuthor Commented:
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.
ezraelAuthor Commented:
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?
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

ezraelAuthor Commented:
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?

bloodredsunCommented:
If you try to load the file and it is already in memory then it will cause this issue. You can either try to only load the file in the init() method of the jsp (which is jspInit())

<%! public void jspInit() { ... } %>

or you could put the code fragement in a static block
<%
static{
    //blah, load file
}
%>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ezraelAuthor Commented:
I load the library doing this:

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

should I try with

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

?

thx!
bloodredsunCommented:
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
ezraelAuthor Commented:
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:

http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21479466.html

Thank you so much!
bloodredsunCommented:
Okay, thanks and I'll have a look
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.