I have a Spring 3 application that is loading a library. The library consists of JAX-WS generated Java bindings. When the library is included in the WAR file and deployed to Tomcat the application runs great.
However when we moved the library into Tomcat (CATALINA_HOME/lib) Spring is no long able to instantiate classes in the library due to what looks like a classloader issue:
Caused by: java.lang.IllegalArgumentException: interface com.sun.xml.ws.developer.WSBindingProvider is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) ~[na:1.6.0_24]
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) ~[na:1.6.0_24]
at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:604) ~[jaxws-rt-2.2.1.jar:2.2.1]
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344) ~[jaxws-rt-2.2.1.jar:2.2.1]
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326) ~[jaxws-rt-2.2.1.jar:2.2.1]
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:308) ~[jaxws-rt-2.2.1.jar:2.2.1]
at javax.xml.ws.Service.getPort(Service.java:92) ~[na:1.6.0_24]
at org.ghc.webservices.element.services.stubs.Express.getExpressSoap12(Express.java:94) ~[element-soap-libs-dev-1.16.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
at org.springframework.beans.factory.su开发者_如何学JAVApport.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145) ~[spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
Unfortunately we need to keep this library external to the application.
I am stumped on how to correct this issue and would appreciate any suggestions.
-Thanks!
are you sure the directory that you placed the library in, is available in the classpath? we normally place our external libraries in common\lib like this.
%CATALINA_HOME%\common\lib\<yourjar>.jar
And if that didn't work then try explicitly appending the your jar and set in classpath in catalina.bat file.
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\common\lib\<yourjar>.jar
精彩评论