关于在执行时在build.xml中获取错误

时间:2012-10-03 18:04:44

标签: java web-services ant cxf

我正在尝试开发一个JAX WS Web服务,但是在为WSGEN实用程序运行一个ant工具时出错,我的Web服务只包含一个方法,下面是我的代码..

界面: -

    package Demo;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

@WebService
@SOAPBinding(style = Style.DOCUMENT) //optional

public interface Calculator {

    @WebMethod  
    public int add(int a ,int b);

}

后跟服务端点类

  package Demo;
import javax.jws.WebService;

//Service Implementation
@WebService(endpointInterface = "Demo.Calculator")

public class CalculatorImpl implements Calculator {

    @Override
    public int  add(int a ,int b) {

        return a+b;
    }
}

build.xml是..

<target name="wsgen" >

  <exec executable="wsgen">

   <arg line="-cp ./bin -keep -s ./src -d ./bin Demo.CalculatorImpl"/>

  </exec>

 </target>

</project>

但是在执行build.xml时会出现以下错误,即...

Buildfile: D:\saralworkspace\aa\build.xml
wsgen:

BUILD FAILED
D:\saralworkspace\aa\build.xml:5: Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2, The system cannot find the file specified

请告知它出了什么问题以及如何克服它...... !!

1 个答案:

答案 0 :(得分:1)

在可执行标记中使用完整文件名

<exec executable="D:\Program Files\Wsge\wsgen">

或者确保你的wsgen程序在你的CLASSPATH变量上

相关问题