Installing latest JAX-WS on JDK 6
Asked Answered
P

4

12

I followed the instructions here for properly installing the latest JAX-WS release (2.2.6) on top of my JDK v1.6.0_31 (i.e. copying the jaxws-api.jar and jaxb-api.jar from the JAX-WS release into my ${JAVA_HOME}/lib/endorsed directory). From inside Eclipse I can run the wsimport ant task properly and the generated code is giving a version stamp in the comments of:

/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.6b21 
* Generated source version: 2.2
* 
*/

The problem I'm having is that the generated client code is showing errors which lead me to believe that the compiler is still using JAX-WS version 2.1:

The constructor Service(URL, QName, WebServiceFeature[]) is undefined

and

The attribute required is undefined for the annotation type XmlElementRef

I tried explicitly setting the -Djava.endorsed.dir arg when starting Eclipse and I also tried setting this arg under Eclipse->Preferences->Java->InstalledJREs but neither of these helped. My wsimport ant task classpath is defined to look at the JAX-WS 2.2.6 jars. I also tried setting my project build path to pull in the 2.2.6 jars. Nothing seems to work. Am I missing something?

Protoxide answered 3/5, 2012 at 15:18 Comment(1)
Are you sure that the java binary you run wsimport with belongs to the JAVA_HOME you have altered?Christmas
F
6

Not sure why it's not picking it up front he endorsed lib (other than maybe the endorsed dir you put your libs is for a different JRE/JDK that eclipse is using?), but regarding the last thing you tried... adding the jars directly to the build path.... this will work if you order the build path entries such that your JAX-WS jars are above the JDK entry.

Fluoride answered 3/5, 2012 at 16:44 Comment(0)
F
1

You had produced code that needs JAX-WS 2.1. Version 2.0 does not have WebServiceFeature class, and as result also not constructor in Service with such a argument type.

As you see, in Java SE 6 there is no such a constructor: javax.xml.ws.Service SE 6, but for example in Java EE 6 there is: javax.xml.ws.Service EE 6

enter image description here

Furnish answered 5/8, 2014 at 22:10 Comment(0)
G
1

If possible one solution could to replace jdk1.6 with a higher jdk (either 1.7 or 1.8).

Gymkhana answered 22/9, 2016 at 13:52 Comment(0)
G
0

You can use the below command to generate the stubs wsdl2java -p -client -frontend jaxws21

Gainsborough answered 4/3, 2015 at 17:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.