JAX-WS and version conflicts

拈花ヽ惹草 提交于 2019-12-31 00:42:51

问题


As test project I've create a very simple WebService using wsdl and jax-ws. The client runs very well if it is deployed as web application in GlassFish but if I start the same (WebService-)Code in Eclipse directly, I get the following error:

WARNUNG: Input Action on WSDL operation AddNumbers and @Action on its associated Web Method addNumbers did not match and will cause problems in dispatching the requests
Exception in thread "main" java.lang.NoClassDefFoundError: org/glassfish/ha/store/api/BackingStoreException
    at com.sun.xml.ws.rx.mc.runtime.McConfigurationFactory.createInstance(McConfigurationFactory.java:66)
    at com.sun.xml.ws.rx.mc.runtime.McTubeFactory.createTube(McTubeFactory.java:68)
    at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:84)
    at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClient(TubelineAssemblerFactoryImpl.java:130)
    at com.sun.xml.ws.client.Stub.createPipeline(Stub.java:228)
    at com.sun.xml.ws.client.Stub.<init>(Stub.java:205)
    at com.sun.xml.ws.client.Stub.<init>(Stub.java:178)
    at com.sun.xml.ws.client.sei.SEIStub.<init>(SEIStub.java:85)
    at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:608)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:348)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:312)
    at javax.xml.ws.Service.getPort(Service.java:134)
    at mnm.namedesdienstes.webservice.service.NameDesDienstesService.getNameDesDienstesPortTypePort(NameDesDienstesService.java:56)
    at webserviceClient.NameDesDienstesClient.myTest(NameDesDienstesClient.java:12)
    at webserviceClient.NameDesDienstesClient.main(NameDesDienstesClient.java:25)
Caused by: java.lang.ClassNotFoundException: org.glassfish.ha.store.api.BackingStoreException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 16 more

After some research I found out that it must have something to do with different versions of some library files. So now my question is, how can I "fix" my eclipse java execution to run my webservice client correctly? I've found some tips to copy some jar to an endorsed-directory, but which jars into which directory :-)

I'm using Max OS 10.6.8, Eclipse Project uses JVM 1.6. My Mac Java Version is

xmacbook:~ cstraube$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

UPDATE: My first try (thanks to the link from remipod) I performed the following steps:

  1. Get the directory of endorsed lirbaries with System.out.println(System.getProperty("java.endorsed.dirs"));
  2. Next, I copied the two files JAXWS2.1.7-20090419.jar and JAXB2_20080513.jar (both Version 2.1.7) into this directory
  3. Unfortunately I get still the same error

回答1:


I have similar problem with yours when deploying web service (JAX-WS) in tomcat 7. The missing class definition could be found in ha-api.jar.

org/glassfish/ha/store/api/BackingStoreException

You should add the ha-api.jar (From JAX-WS distribution) into server lib. For my case, the eclipse run tomcat 7, so the location is (Tomcat 7.0\lib).




回答2:


You have to copy the fitting versions of jaxws-api.jar and jaxb-api.jar into the directory /Library/Java/Home/lib/endorsed (Mac).




回答3:


Have a look at this link JAX WS with WS 2.1.1. You will need to give precedence to your version of jaxws to the provided jaxws from the jre 1.6.

Edit: Glassfish already includes some libraries, as well as java 6. I had to track down version conflicts with jaxws in glassfish 3.1 / 3.1.1 and java 6 / 7. You might check the exact java runtime eclipse uses to start the application and look for duplicate jars on the effective classpath.

The endorsed mechanism just provides an easy and error prone way to override the included jaxws distribution. Error prone, because your colleague will suffer from the same problem.

I havn't seen the exception org.glassfish.ha.store.api.BackingStoreException in the context of jaxws. Your version conflict could be created by another library than jaxws...




回答4:


I experienced the exact same exception

org.glassfish.ha.store.api.BackingStoreException

And after ensuring my JAX-WS and JAX-B jars were all the same version the issue was still occurring.

THE FIX: I then added the ha-api.jar to the WEB-INF\lib directory and this solved the issue.

The clue here was the "ha" package in the exceptions class path as seen above. Hope this helps!



来源:https://stackoverflow.com/questions/7580803/jax-ws-and-version-conflicts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!