3

I'm using the java bonjour library (dns_sd.jar) in a web application running in Jboss web server.

When I start the server a Servlet finds every resource on the network with bonjour and returns to the user. The first time everything runs great but when I redeploy the web app I get:

java.lang.UnsatisfiedLinkError: Native Library C:\Windows\System32\jdns_sd.dll already loaded in another classloader

I already tried deletting the .dll and the samething happens.

Why does it even refer the .dll if I have the .jar lib in my web app?

Does anyone have any idea on how to fix this?

out_sid3r
  • 1,018
  • 2
  • 20
  • 42

2 Answers2

0

If you're using JBoss 7, try moving the jar file that uses the dll into a JBoss module. Restart JBoss so that it picks up the module. Modify your MANIFEST.MF file so that it contains "Dependencies: theNameYouGaveIt".

Where "theNameYouGaveIt" is the name you chose in your module's "yourModule/main/module.xml" file.

That way, JBoss doesn't reload the library over and over again. Then undeploy/redeploy your .ear or .war over and over again.

Jared
  • 311
  • 1
  • 3
  • 3
0

you do undeploy before you redeploy it. you no need to delete the dll file,it is not at all related to your error.it is an error of java and jboss.the problem is when you are redeploying it,it is unable to unload the libraries which you have loaded at the time of initial deployment.so better you check whether the library is loaded or not before you load the library next time,if it is already loaded do not load the library.

johnkrishna
  • 160
  • 2
  • 11
  • 1
    Many thanks for help...but I did try to undeploy and deploy again but only restarting the server works...which is quite a pain considering the time it takes to deploy the other apps I need. Is there anyway to unload the library if it is already running within a java function? Because I don't know how to tell bonjour not to load it again. – out_sid3r Feb 29 '12 at 11:31
  • 1
    Although I didn't get a complete answer...at least I got a confirmation...not a solution though – out_sid3r Mar 05 '12 at 23:51
  • 1
    Have you found any solution yet ? – thd May 21 '13 at 21:21