5

When I use wsgen or apt to generate web service artifacts in JDK 7 with command.

wsgen -s src -cp CLASS_PATH -d OUTPUT_DIRECTORY  com.sun.WebServiceSEI

displays following warning message

The apt tool and its associated API contained in the package com.sun.mirror have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the javac tool and the APIs contained in the packages javax.annotation.processing and javax.lang.model to process annotations.

How can I generate web service artifacts without using wsgen or apt to remove this warning?

Baha
  • 475
  • 1
  • 10
  • 26
  • Do you work in Sun? If not, why you have decided to put your SEI to `com.sun` package? – dma_k Feb 05 '12 at 15:06
  • Will packaging in directory structure com.sun not work for wsgen? I have just provided sample sei com.sun.WebServiceSEI. My question is something different? can you please answer my question? – Baha Feb 06 '12 at 03:35

3 Answers3

2

javac is the replacement. They added a pluggable annotation processing system into javac (JSR 269: Pluggable Annotation Processing API) a while back (Java 6 I think). The annotation processor you are looking for is in jaxws-tools.jar (Metro download). Once you have that jar on your classpath you should be able to run javac with a -processor com.sun.tools.ws.processor.modeler.annotation.WebServiceAp option. There is also a Ant task, com.sun.tools.ws.ant.AnnotationProcessingTask. They talk about it a little here http://jax-ws.java.net/nonav/2.2.6/docs/ch04.html#tools-annotation-processing but don't really explain it. Maybe the required annotation processor ships with the JDK but if so I couldn't find it.

Chase
  • 3,123
  • 1
  • 30
  • 35
1

The warning is generated because WsgenTool class is using classes from com.sun.mirror.apt package, which seem to be deprecated in JDK7. I think in a while JAX-WS team will release jaxws-ri which does not use this API, but it may happen somewhere closer to JDK8 release.

dma_k
  • 10,431
  • 16
  • 76
  • 128
  • However I am using wsgen that is shipped with JDK 7. – Baha Feb 09 '12 at 05:15
  • 1
    AFAIK, `wsgen` is not a part of JDK. I might be wrong, as JAX-WS is able to generate WSDL from SEI... Anyway it looks like wsgen part has not been updated. What is your classpath when you run `wsgen`? – dma_k Feb 10 '12 at 01:22
  • 1
    I am using JDK 7 update 1 wsgen.exe from JDK_HOME\bin folder. My classpath has jaxws-ri 2.2.5 libaries when I compile SEIs however when I run wsgen these libraries are not in classpath. I just came across to very useful links https://blogs.oracle.com/darcy/entry/apt_ending and https://blogs.oracle.com/darcy/entry/the_passing_of_apt. These links specify that some portion of jax-ws is in the jdk and they have committed the changes to remove apt from future jdk8. I am still not sure whether they are going to remove apt from jdk 7 or not. – Baha Feb 11 '12 at 16:13
  • 2
    @dma_k wsgen (and apt,wsimport) are part of the JDK since 1.5. The JAX-WS project has a version that is not currently available in JDK 6. – Scott Markwell Sep 12 '12 at 23:12
0

Im afraid, it is not possible. What you can do is switch back to old JDK which was working for you, that is your best bet.

bazuka
  • 102
  • 1
  • 6