I got The constructor Service(URL, QName, WebServiceFeature[]) is undefined error after I run wsimport for my client web service. Im using JDK 1.6. Please help.
7 Answers
add additional option "-target 2.0" while using wsimport to generate source codes for JAX-WS 2.0 and so on.

- 328
- 2
- 11
-
This worked for me, as I'm using Java EE 5, which overrides the version of JAC-WS. – Half_Duplex Jan 15 '13 at 21:01
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

- 41,366
- 10
- 132
- 135
-
1@Sergey What do you mean? In general past versions do not reflect future changes. When 2.1 features are needed, 2.1 should be used. – Mikko Maunu Jun 22 '12 at 04:23
-
Mikko Maunu, sorry for being stupid but how to set the version of jaxws - just replace jar files? – Sergey Jun 27 '12 at 10:49
-
1Yeah you need the new code, for an lib make sure it takes precedence over the jdk classes (in eclipse the order and export order must place the jdk below the new lib). Also, there is jdk 1.7. – ThomasRS Jan 09 '13 at 15:52
-
1I personally think that @Sireesh Yarlagadda's answer is the real solution whereas this answer is more like a hints on the problem. – huahsin68 Aug 28 '14 at 14:14
-
Change your JAX-WS in the preferences. It is compatibility issue for Java 6 SE and Java EE
Sometimes changing from Java 1.6 to Java 1.7 also solves this issue.

- 12,978
- 3
- 74
- 76
Additionally to switch from java 6 to java 7 you may need to change the 'Order and Export' Eclipse tab in 'Java build path' and put 'JRE system library' on top of the list. If that works it could mean you have an old jar somewhere in your project.

- 10,453
- 2
- 27
- 52
You can manually add webservices-api.jar from JAX-WS 2.2 API, into /lib/endorsed. See the bottom of this page: https://blogs.oracle.com/ritzmann/entry/metro_2_0_on_java

- 11
- 1
Check the Java version in Eclipse. Go the command prompt and check for the Java version there (command: java -version). Match both the versions and it should work just fine.

- 773
- 6
- 6