嗨,我正在学习 web 服务,因为我正在创建一个示例项目,该项目从给定的 wsdl(wsdl2Java) 生成 java 并将代码生成到 wsdl(java2ws)。wsdl2java 工作正常,但在 java2wsdl 中,我的 ANT 文件中出现如下异常
Buildfile: D:\sarvan\java\webservice\java2wsVSws2java\build.xml
cxfWSDLToJava:
[echo] **********Genarating WSDLToJava***********
cxfJavaToWSDL:
[echo] ************Genarating JavaToWSDL*************
[java] JavaToWS Error: org.apache.cxf.tools.common.ToolException: Fail to load class : D:\sarvan\java\webservice\java2wsVSws2java\build \genClasses/com/saravana/webservice/services/CalServiceService.class
compile-all:
[javac] D:\sarvan\java\webservice\java2wsVSws2java\build.xml:54: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 9 source files to D:\sarvan\java\webservice \java2wsVSws2java\build\genClasses
BUILD SUCCESSFUL
Total time: 5 seconds
请问是什么原因造成的,求大神帮忙!!我的蚂蚁:
<target name="cxfJavaToWSDL" depends="cxfWSDLToJava">
<echo> ************Genarating JavaToWSDL************* </echo>
<java classname="org.apache.cxf.tools.java2ws.JavaToWS" fork="true">
<arg value="-wsdl"/>
<arg value="-classdir"/>
<arg value="${classes}"/>
<arg value="-cp"/>
<arg value="${classes}/**/CalServiceService.class"/>
<arg value="-o"/>
<arg value="${lib.dir}/CalServiceService.wsdl"/>
<arg value="${classes}/com/saravana/webservice/services/CalServiceService.class"/>
<classpath>
<path refid="class.path"/>
<pathelement location="${classes}/**/*.class"/>
</classpath>
</java>
<target name="cxfWSDLToJava" >
<echo message="**********Genarating WSDLToJava***********"/>
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-client"/>
<arg value="-d"/>
<arg value="${genCode.dir}"/>
<!-- <arg value="-b"/>
<arg value="./async_binding.xml"/> -->
<arg value="${lib.dir}/CalService.wsdl"/>
<classpath>
<path refid="class.path"/>
</classpath>
</java>
</target>
<target name="compile-all" depends="cxfJavaToWSDL">
<javac debug="on" destdir="${classes}">
<src path="${genCode.dir}"/>
<classpath refid="class.path"/>
</javac>
</target>
以及我在 ANT 中的属性和类路径
<project name="javawsVSwsTojava" default="compile-all" basedir=".">
<property name="lib.dir" location="./WebContent/WEB-INF/lib" />
<property name="genCode.dir" location="./Java Resources/generatedcode" />
<property name="classes" location="./build/genClasses" />
<property name="wsdl.location" location="" />
<path id="class.path">
<fileset dir="${lib.dir}/dependencies">
<include name="**/*.jar" />
</fileset>
</path>