Using JAX-WS 2.2.5 client with JDK/JRE 1.5

允我心安 提交于 2020-01-02 02:01:07

问题


Java 6 shipped with JAX-WS 2.0. Java 5 didn't ship with JAX-WS as far as I know.

I was able to use JAX-WS 2.2.5 with Java 1.6 for creating Webservice client stubs by using the Java Endorsed Override Mechansim which lists JAX-WS as one of the components which can be replaced in Java 6.

All I had to do was create a lib\endorsed directory in my JDK & JRE 6 paths & then copy jaxb-api.jar & jaxws-api.jar from JAX-WS 2.2.5 into the directory named endorsed. And both JDK & JRE 6 picked up the 2.2.5 JAX-WS automatically.

I could not find similar Java Endorsed Override Mechanism in the Java 5 documents. How I found one here. This doesn't explicty mention JAX-WS like the Java 6 documents, but it also mentions the endorsed dirs.

I created a similar 'endorsed' directory in both the JDK & JRE lib directory. I copied all the jars from JAX-WS 2.2.5 (a total of 23 jars) into the endorsed directory. However, unlike Java 6, neither javac.exe nor java.exe picked this up directly. I had to run both java.exe and javac.exe with this command line argument

-Djava.endorsed.dirs=<JDK/JRE1.5_DIR>\lib\endorsed

Everything seems to work fine, but I am wondering if this is guaranteed to work - any problems anyone has faced before? Does JAX-WS 2.2.5 support Java 5?


回答1:


None of the JAX-WS (JAXB) classes are included in Java SE 5, so you don't need to use the endorsed mechanism, you can just put it on your classpath. See the following link for Jar dependencies:

  • https://jax-ws.java.net/nonav/2.2.5/docs/ReleaseNotes.html#Jar_dependency

UPDATE

But does JAX-WS 2.2.5 support Java 5?

Yes it does, the following is taken from this link: https://jax-ws.java.net/nonav/2.2.5/docs/ReleaseNotes.html#Required_Software

Requires JDK 5.0 Update 2 or later

    -



回答2:


In one banking application (I developed) endorsement works since 2005 with Java 1.4.

System property 'java.endorsed.dirs' was introduced in Java 1.4, so you can use it with Java 5 - it is guarantied to work.

For example see this docs or this one.

Edit

And yes, JAX-WS 2.2.5 is compatible with JDK/JRE 1.5, see Required Software section in official release notes. Actually this was the last version of JAX-WS compatible with Java 5.



来源:https://stackoverflow.com/questions/27182395/using-jax-ws-2-2-5-client-with-jdk-jre-1-5

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