Ant wsimport runtime error

I have a simple ant script to create my classes from sdl. Unfortunately, wsimport fails immediately. I suspect this has something to do with classpaths.

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport"> <classpath> <pathelement location="${jaxws.lib.dir}/jaxws-tools.jar" /> </classpath> </taskdef> <wsimport wsdl="${project.wsdl.dir}\some.wsdl" destdir="${jaxws.output.dir}" keep="false" extension="true" verbose="true" wsdlLocation="http://localhost/wsdl" target="2.1"> <depends file="${project.wsdl.dir}"/> <produces dir="${jaxws.output.dir}"/> </wsimport> 

This is the result that it produces:

[wsimport] March 15, 2013 12:23:25 com.sun.xml.bind.v2.util.XmlFactory createDocumentBuilderFactory [wsimport] SEVERE: null [wsimport] java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFact. setFeature (Ljava / lang / String; Z) V [wsimport] in com.sun.xml.bind.v2.util.XmlFactory.createDocumentBuilderFactory (XmlFactory.java:176) [wsimport] in com.sun.tools.xjc.reader .internalizer.DOMForest. (DOMForest.java:162) [wsimport] at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.resetSchema (SchemaCompilerImpl.java:215) [wsimport] at com.sun.tools.xjc.api.impl .s2j.SchemaCompilerImpl. (SchemaCompilerImpl.java:114) [wsimport] at com.sun.tools.xjc.api.XJC.createSchemaCompiler (XJC.java:72) [wsimport] at com.sun.tools.ws.wscompile.WsimportOptions. (WsimportOptions.java:152) [wsimport] at com.sun.tools.ws.wscompile.WsimportTool. (WsimportTool.java:89) [wsimport] at com.sun.tools.ws.wscompile.WsimportTool. (WsimportTool.java:92) [wsimport] at com.sun.tools.ws.ant.WsImport2.execute (WsImport2.java:848) [wsimport] at com.sun.istack.tools.ProtectedTask.execute (ProtectedTask.java : 103) [wsimport] in org.apache.tools.ant.UnknownElement.execute (UnknownElement.java:269) [wsimport] in org.apache.tools.ant.Task.perform (Task.java data64) [wsimport] in org.apache.tools.ant.Target.execute (Target.javahaps01) [wsimport] in org.apache.tools.ant.helper.ProjectHelper2.parse (ProjectHelper2.java:135) [wsimport] in org.eclipse .ant.internal.launching.remote.InternalAntRunner.parseBuildFile (InternalAntRunner.java:192) [wsimport] in org.eclipse.ant.internal.launching.remote.InternalAntRunner.run (InternalAntRunner.java:401) in wsim .eclipse.ant.internal.launching.remote.InternalAntRunner.main (InternalAntRunner.java:138)

If I started command line creation through verbose logging, in wsimport, from the bin jax-ws directory everything works fine

 [wsimport] command line: wsimport -d C:\Development\Source\ccs\jaxws-output -extension -verbose -target 2.1 C:\Development\Source\ccs\wsdl\some.wsdl -wsdllocation http://localhost/wsdl 

I tried to find a solution, but now I am not aware of the ideas

+4
source share
1 answer

I think one of the tedious things about using the approach you mention ( taskdef and wsimport ) is to add environment variables, especially if you want to use SSL and Basic authentication in your web service. In the other hand, you can use the wsimport tool without defining a new task. Something like that:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE project> <project name="generate-client" default="main" basedir="."> <property name="java.home" value="X:\Software\jdk1.7.0_11" /> <property name="wsdl.location" value="http://localhost/wsdl" /> <target name="main"> <exec executable="${java.home}\bin\wsimport.exe"> <arg line="${wsdl.location} -s src -Xdebug -verbose -Xnocompile" /> </exec> </target> </project> 

Now that you have an idea, you can configure the output directory, add the target version ...

+7
source

Source: https://habr.com/ru/post/1469466/


All Articles