2012-10-03 33 views
0

我試圖開發一個JAX WS Web服務,但運行WSGEN實用程序的ant工具時出現錯誤,我的Web服務僅包含一個方法add,下面是我的作品的代碼..關於在執行時在buld.xml中獲取錯誤

接口: -

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

使用完整的文件名

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

,或者確保您的WSGEN程序在你的CLASSPATH變量

相關問題