1
votes

I am trying to migrate from Java 7 to Java 8 for an existing system , which implements Jax-ws 2.0. The build and deployment process is uses Ant task (apt, wsgen, wsimport) to generates wsdl and libraries from java annotated service end point interface and from generated WSDL prepares client libraries. Which works as expected until Java – 7. But when I tried to use jdk-8 for building, got problem in using jax-ws libraries and above mentioned ant task. I have upgraded the JAX-WS lib to JAX-WS RI – 2.2.8 and JAX-WS 2.2.10 , which did work until WSDL and schema generation using ant task wsgen, but Still I am unable to resolve the generation of client libraries from generated WSDL using wsimport. I am getting following error

javax.xml.validation.SchemaFactoryConfigurationError: Provider for class javax.xml.validation.SchemaFactory cannot be created

My wsgen and wsimport scripts are as 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> 

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

<wsimport sourcedestdir="${generated.dir}/src" destdir="${build.dir}" wsdl="${wsdl.location}"  keep="true" extension="true" package="com.smruti.webservice.client"/>

Note : I am using jdk 8 , ant- 1.9.4 , jax-ws ri - 2.2.10 libs.

1

1 Answers

1
votes

As a work around I am able to solve the above problem by using jdk provided wsimport.exe instead of ant task. Below is the script for the same ..

<exec executable="C:\Program Files\Java\jdk1.8.0_40\bin\wsimport.exe">
        <arg line="${wsdl.location} -s ${generated.dir}/src -p  com.smruti.webservice.client -d ${build.dir} -extension -keep -Xdebug -verbose" />
</exec>

But, Still not able to use wsimport as an ant task with java 8 and jax-ws-2.2.10.