Home : java.lang.UnsatisfiedLinkError - Native Library ...\ntvinv.dll already loaded in another classloader
Q122967 - ERRMSG: java.lang.UnsatisfiedLinkError - Native Library ...\ntvinv.dll already loaded in another classloader

java.lang.UnsatisfiedLinkError - Native Library ...\ntvinv.dll already loaded in another classloader

 

You will get this error if ntvinv.dll is already loaded in another classloader. To to get the information of the classloader in use, add this line in your Java code:

System.out.println("Classloader: " + this.getClass().getClassLoader());

If the value printed by each Java client is different, then you know that ntvinv.dll is not loaded in the same classloader.

Java Application

If you are using native mode, check that the jintegra.jar and ntvinv.dll files are only being loaded in one classloader (specifically, the System classloader). Only classes loaded by the System classloader can use JNI, and J-Integra's native mode uses JNI. To ensure that the you are using the System classloader, make sure jintegra.jar and ntvinv.dll are being referenced from the System CLASSPATH and PATH environment variable. To set this varaible, click Start > Control Panel > System > Advanced > Environment Variables, then set CLASSPATH and PATH from System variables, NOT from User variables.

Java Applet

If you are using several Applets in native mode accessing different DLLs at the same time, or launching several Applets that embed different ActiveX Controls at the same time, make sure that all the Applets are using the same classloader. According to the section ClassLoader sharing policy in Appendix 4: Microsoft VM and Java 2 Applet Compatibility Issues from Java Plug-in 1.4.2 Developer Guide, one way to achieve this is to make sure that in all the <applet> tag of the HTML code:

  • codebase values are the same and
  • cache_archive values are the same and
  • java_archive values are the same and
  • archive values are the same

For example, if you have one Applet embeds Acrobat Reader ActiveX Control, and another Applet embeds Microsoft Office Spreadsheet control, and the corresponding HTML pages are:

For the Applet embedding Acrobat Reader ActiveX Control:

<HTML><HEAD><TITLE>J-Integra Applet Example</TITLE></HEAD>
<BODY>
<applet codebase="http://localhost/applet/PDF/" code="AppletPDF.class" width=400 height=400 archive="jintegra.jar, pdfocx.jar">
</applet>
</BODY>
</HTML>

For the Applet embedding Microsoft Office Spreadsheet control:

<HTML><HEAD><TITLE>J-Integra Applet Example</TITLE></HEAD>
<BODY>
<applet codebase="http://localhost/applet/Excel/" code="AppletExcel.class" width=400 height=400 archive="jintegra.jar, MSOWC.jar">
</applet>
</BODY>
</HTML>

Then you will get the java.lang.UnsatisfiedLinkError - Native Library ...\ntvinv.dll already loaded in another classloader because each HTML file have different codebase and archive values.

The resolution is to move all the files under http://localhost/applet/PDF/ and http://localhost/applet/Excel/ to http://localhost/applet/, and then make a new jar file, class.jar, containing the classes extracted from pdfocx.jar and MSOWC.jar, so that the HTML files have the same codebase and archive values. They also have the same cache_archive and java_archive values that are null.

For the Applet embedding Acrobat Reader ActiveX Control:

<HTML><HEAD><TITLE>J-Integra Applet Example</TITLE></HEAD>
<BODY>
<applet codebase="http://localhost/applet/" code="AppletPDF.class" width=400 height=400 archive="jintegra.jar, class.jar">
</applet>
</BODY>
</HTML>

For the Applet embedding Microsoft Office Spreadsheet control:

<HTML><HEAD><TITLE>J-Integra Applet Example</TITLE></HEAD>
<BODY>
<applet codebase="http://localhost/applet/" code="AppletExcel.class" width=400 height=400 archive="jintegra.jar, class.jar">
</applet>
</BODY>
</HTML>
Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/23/2006.
Last Modified on 7/11/2006.
Last Modified by No Author Name Available!.
Article has been viewed 16652 times.
Rated 6 out of 10 based on 36 votes.
Print Article
Email Article