JAX-WS客户端自动生成的代码如下,结果在Tomcat上就运行失败,告诉说file:./...wsdl文件找不到。


         private final static URL YourService_WSDL_LOCATION;

         static {
                URL url = null;
                 try {
                        url = new URL( "file:./META-INF/wsdl/IF/YourServiceExport1.wsdl");
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                }
                 YourService_WSDL_LOCATION = url;
        }

如下修改相应的 YourService.java文件就可以了:

         private final static URL YourService_WSDL_LOCATION;

         static {
                
                 YourService_WSDL_LOCATION = ThisJavaClass. class.getResource( " /META-INF/wsdl/IF/ YourServiceExport1.wsdl");
    }

当然,如上修改之前,请确保你的Service.java文件和wsdl文件打在一个包里边。