Tom
Tom

Reputation: 3166

Installing latest JAX-WS on JDK 6

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?

Upvotes: 12

Views: 16217

Answers (4)

Ivan Aranibar
Ivan Aranibar

Reputation: 2286

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

Upvotes: 1

Tushar
Tushar

Reputation: 489

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

Upvotes: 0

Sireesh Yarlagadda
Sireesh Yarlagadda

Reputation: 13726

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

Upvotes: 1

ceposta
ceposta

Reputation: 446

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.

Upvotes: 6

Related Questions