- This topic has 9 replies, 2 voices, and was last updated 18 years, 1 month ago by jediez.
-
AuthorPosts
-
jediezMemberhi there.
I developed and application which uses a dll to get data from windows registry, there is a dll located at a directory included in PATH environment variable. Ir works fine If I invoke it from and standalone application, but When I tested it from a Web App hosted in Tomcat, It throws a javalinkunsatisfiedException. It seems like TomCat gets a different value for PATH Variable.
The question would be:
– Where does TomCat get java.library.path value?
– How Can I include a new directory there?Thanks in advance.
Esteban Diez.
Riyad KallaMemberEsteban,
I cannot tell from your post if you are asking in the general case, or if you are a MyEclipse user. If you are a MyEclipse user, edit your Tomcat connector settings, under Path, and add the directory with the DLL in it, to the ‘Path’ (last box), that will fix it.
jediezMemberHi Riyad
Actually, I am asking in the general case; although I am a MyEclipse user, the application that I am develoving is gonna be hosted in a server that doesn’t MyEclipse.
What can I do, then?
Is there any way to solve this?Thanks u for your cooperation.
Esteban D.
Riyad KallaMemberMoving to OT > Soft Dev
Please Google for “Tomcat DLL” or something similar, you will find plenty of information on this.
jediezMemberHey Ryad.
If I am posting this topic in this forum It’s because all information I got from the Internet (GOOGLE) has either been few or not useful.
Thanks anyway for trying helping me.!Regards,
Esteban
Riyad KallaMemberA quick search brought up this:
http://forum.java.sun.com/thread.jspa?threadID=369425&messageID=3786636You need to add the dir that contains the DLL in your System PATH it seems like.
jediezMemberRiyad.
Adding the dir that contains the DLL in my System path does not solve the problem!. I’ve already tried that.
It seems like when u are running an app hosted in Tomcat, the value for java.system.path variable is not the same as the one on System Path (Environment variable).How can I add a new directory to the Path, If my application runs from Tomcat???????
It works fine for stand-alone app, but not for Tomcat.Thanks a lot for any help with this.!
Esteban
jediezMemberHi Guys!. Hi solved the problem, by following this instructions:
Place the jar file that has the JNI Java classes in the {CATALINA_HOME}\shared\lib folder.
If the folder doesn’t exist then create it.
The JNI DLL must be located somewhere visible from either the java.library.path java system property or the Path windows system (or user) property.
To set the java.library.path java system property with Tomcat simply set the JAVA_OPTS environment variable before executing {CATALINA_HOME}\bin\startup.bat:set CATALINA_HOME=someTomcatRootFolder
set JAVA_HOME=someJavaRootFolder
set JAVA_OPTS=-Djava.library.path=someJniDllPath
cd “%CATALINA_HOME%\bin”
call startup.bat——-
Although, I am still getting an error because there are two apps hosted at my Tomcat Server, do u know how I can make this up?
The error message is (Its shown, once the second app attempts to use the dll):java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\Apache Software Foundation\Tomcat 5.0\shared\classes\jRegistryKey.dll already loaded in another classloader
Thanks a lot!.
Esteban Diez G.
Riyad KallaMemberUnfortunately the VM can only load a DLL once, so you will need to work around that issue.
jediezMemberSo u mean I cant have two apps hosted in Tomcat Server that use same dll?
-
AuthorPosts