.dll already loaded in another classloader

2019-08-30 08:45发布

问题:

I am integrating a web service in my web application. The web service provided me a .dll and .jar file. I placed .dd in /jre/bin and .jar in /jre/lib After that I developed my code, and deployed the app. During development, I also included the .jar file in my project build path. On running it through tomcat, it gives me the error:

java.lang.UnsatisfiedLinkError: Native Library .dll already loaded in another classloader

Can someone tell me where am I goign wrong. I did search this problem, but none of d answers were clear.

When I remove the .dll or .jar file, my program fails saying it could not find it. I also tried removing it from my external lib, but that also din work

Please help

Thanks, Akshay

回答1:

You can't load the same library twice.

Paste the class in a jar file under /lib/, it will be shared with other .WAR files.



回答2:

I had this problem and solve by removing other ".jar" file that was using one ".dll"

If there is same .jar file in your project and your tomcat/lib ( and may be in jre/bin) and all this ".jar" need to try to get one resource this problem occurs.

I removed all RxTxcomm.jar except one that was in tomcat/lib.

In my case i have "RxTxcomm.jar" in "myproject/lib", "tomcat/lib" and "jre/lib" and rxtxserial.dll was in jre/bin.

So my problem fixed.



标签: java dll