1. 程式人生 > >; nested exception is: java.io.FileNotFoundException: D:\tomcat7\webapps\axis\WEB-INF\jwsC

; nested exception is: java.io.FileNotFoundException: D:\tomcat7\webapps\axis\WEB-INF\jwsC

webservice 即時釋出 報錯說找不到class檔案

http://127.0.0.1:8080/axis/HelloWS.jws?wsdl

Sorry, something seems to have gone wrong... here are the details:

Fault - ; nested exception is: 
	java.io.FileNotFoundException: D:\tomcat7\webapps\axis\WEB-INF\jwsClasses\HelloWS.class (系統找不到指定的檔案。)

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.io.FileNotFoundException: D:\tomcat7\webapps\axis\WEB-INF\jwsClasses\HelloWS.class (系統找不到指定的檔案。)
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}hostname:admin-PC


原因是 HelloWS.jws 是由HelloWS.java 檔案直接重新命名得到的,裡面包含了package的路徑,而在axis的及時釋出中是不允許的,去掉即可。

錯誤的

package com.demo.action;               //錯就錯在這一行


public class HelloWS {
public String firstwsmethod(String a,String b){
String result="a="+a+" b="+b;
return "You are gteat,the result is "+result;
}
}

正確的


public class HelloWS {
public String firstwsmethod(String a,String b){
String result="a="+a+" b="+b;
return "You are gteat,the result is "+result;
}
}