web-servicesantjax-wsjava-8wsgen

What is best alternative to wsgen/apt (ant task) tool to generate wsdl using ant for jdk 1.8


My current web service implementation works fine with Jax-ws , ant and jdk-1.7. My requirement is to migrate from jdk 1.7 to jdk 1.8. But when I am using jdk 1.8 to build , I am getting error when generating wsdl using ant task wsgen as : java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory

On web search found , jdk 8 does not support apt tool any more , need to migrate to annotation processing API . Following is the only link I found with proper guidance on how to have an ant task for it and implement.

https://jax-ws.java.net/nonav/2.2.6/docs/ch04.html#tools-annotation-processing-ant-task

But When I used this and resolved all the compiling issues , now there is file generated in the destination place. Also seems there is no support for wsdl creation in this process.

My full build/web-service process is dependent on apt/wsgen/wsimport. How I can properly migrate them into jdk 1.8 ?

Is there any proper documentation or link to follow to overcome it ?

Code snippet of my wsgen task below :

<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
        <classpath refid="project.classpath"/>
</taskdef>

<wsgen resourcedestdir="${smruti.wsdl.dir}"
        sei="com.smruti.webservice.SmrutiWebService"
        keep="true"
        sourcedestdir="${smruti.wsdl.dir}\src"
        destdir="${build.dir}"
        genwsdl="true">
        <classpath>
            <path refid="project.classpath"/>
            <pathelement location="${build.dir}"/>
        </classpath>
</wsgen> 

Solution

  • Which JAX-WS version are you using? Implementation of

        com.sun.tools.ws.ant.WsGen  
    

    has been adapted to new annotation processing API a while ago. Upgrading JAX-WS should resolve the issue.