我在使用带有 Weblogic 10.3 的 jax ws 客户端时遇到了问题。我在简单的 java 项目中生成 web 服务存根并测试与 web 服务的连接。一切正常。但是,当我将这个项目打包到 jar 文件中并将其添加到包含其他 jar 并在 weblogic 上运行的主项目中时,我得到:
java.lang.NoSuchMethodError: org.home.client.AddressWS.getAddressByRequestAsync(ILjava/lang/String;)Ljavax/xml/ws/Response;
当我尝试调用 webservice stub`s 方法时抛出了这个异常。
public class MyServiceImpl implements MyService {
private AddressWS service;
private static final String ENDPOINT = "http://endpoint.address.ws.company.org/";
private static final String SERVICE_NAME = "AddressWSImplService";
@Override
public void setSOAPServiceURL(String serviceURL) {
URL url = createURL(serviceURL);
QName qName = new QName(ENDPOINT, SERVICE_NAME);
AddressWSImplService addressWSImplService= new AddressWSImplService(url, qName);
service = addressWSImplService.getAddressWSImplPort();
}
@Override
public String getAddressById(int id, String param) throws TimeoutException {
// NoSuchMethodError was thrown here
final Response<GetAddressById> response = service
.getAddressByIdAsync(id, param);
return (String) getValue(new Future<String>() {...});}
任何指针都会有所帮助。