问题
I am implmented a webservice in java and webservice client also in java. both the webservice ane webservice client are in different project and i am created dll using jacob.
My Webservice and webservice client is on same computer.now whenever i am calling the webservice using webservice client than encounter following exception.
exception
org.apache.jasper.JasperException: javax.xml.ws.soap.SOAPFaultException: Native Library C:\Program Files (x86)\Java\jdk1.6.0_24\bin\jacob.dll already loaded in another classloader root cause
javax.xml.ws.soap.SOAPFaultException: Native Library C:\Program Files (x86)\Java\jdk1.6.0_24\bin\jacob.dll already loaded in another classloader root cause
java.lang.UnsatisfiedLinkError: Native Library C:\Program Files (x86)\Java\jdk1.6.0_24\bin\jacob.dll already loaded in another classloader
回答1:
jacob.dll can only be loaded once for each instance of a JVM. If the library jacob.jar is loaded more than once, it will try to load jacob.dll more than once, too.
To avoid that, remove the jacob.jar from both webservices and put it in some place where it can be found by a classloader that both webservices share, that way jacob.jar will be loaded only once. For example, if you are using tomcat, put the jacob.jar in the /lib directory of that tomcat.
来源:https://stackoverflow.com/questions/9328520/jacob-dll-already-loadedin-another-classloader