tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Benzel <>
Subject RE: Classloader, JNI and "already loaded in another classloader"
Date Fri, 01 Jun 2001 18:51:53 GMT
OK, I understand better what you were getting at.  

Thanks.  I'll look into it.

-----Original Message-----
From: Pae Choi []
Sent: Friday, June 01, 2001 11:33 AM
Subject: Re: Classloader, JNI and "already loaded in another

I may be completely misunderstanding your case. However, the DLL itself
is runnging as a single instance but has separate data segments for its
each reference. Fro example, 2 users and 1 DLL will result a single instance
of code segment and 2 different data segments for each user respectively.

If so, isn't java bean as a user calling the DLL twice create the same
So two different accesses from the jb's user can get the separate data
by the DLL.


-----Original Message-----
From: Mark Benzel <>
To: '' <>
Date: Friday, June 01, 2001 11:18 AM
Subject: RE: Classloader, JNI and "already loaded in another classloader"

>Yes, it makes sense.  However, I'm not sure if it solves my problem.  In
>the scenario you describe, I would want to have 2 Java Beans, each
>a separate instance of the C++/DLL.  That's because the data contained in
>C++/DLL used by webapps/aaa is different than the data contained in the
>used by webapps/bbb.  An equivalent case would be running the same
>Java application twice with each instance of the Java application accessing
>different set of data.
>-----Original Message-----
>From: Pae Choi []
>Sent: Friday, June 01, 2001 10:30 AM
>Subject: Re: Classloader, JNI and "already loaded in another classloader"
>Just to give a thought for your situation, how would you think if we
>place a plain java bean(i.e., common wrapper class) that interact with the
>c++/dll module and provide the access from the Web components, i.e.,
>servlet/jsp --- the jb's user --- to the java bean(jb). In that case,
>multiple jb's users are accessing a single dll through the jb.
>Does it make sense to you?
>>I have a webapp running under Tomcat 3.2.1 that needs to make JNI calls in
>>order to access data and methods in legacy C++ code.  A servlet is loaded
>>startup of the webapp that, as part if its init method, causes a data set
>>specific to that webapp instance to be loaded into the C++ data
>>This Java code for this servlet contains the following:
>>    static
>>    {
>>        try {
>>            System.loadLibrary("JCoreImpl");
>>            System.out.println("JCoreImpl loaded");
>>            m_bLibraryLoaded = true;
>>        } catch (UnsatisfiedLinkError e) {
>>            m_bLibraryLoaded = false;
>>            System.out.println("JCoreImpl NOT loaded " + e);
>>        }
>>    }
>>Things work fine if there is only one webapp (let's call it
>>If I have a second webapp ("webapps/bbb") that is identical to webapps/aaa
>>except for the data set used in the C++ data structures, then webapps/aaa
>>starts up just fine, but when webapps/bbb is started I get an error
>>JCoreImpl NOT loaded java.lang.UnsatisfiedLinkError: Native Library
>>E:\WebStation\binDebug\JCoreImpl.dll already loaded in another classloader
>>I need to have a separate instance of the native library for each of my
>>webapps as each instance needs to contain data that is unique to that
>>particular webapp.  I have searched through the mail archives and read
>>emails by Craig McLanahan explaining the classloader hierarchy.  But I
>>not been able to find anything specific to loading a unique instance of a
>>native library for each webapp.
>>Any ideas?  Thanks,

View raw message