0
我需要将URL链接到jar文件中的资源。我使用这个URL作为我的服务调用的参数。我的下面的代码失败,“没有这样的文件或目录”错误。JAR中的资源的URL
File file = new File(classLoader.getResource("AXLAPI.wsdl").getFile());
final URL wsdlURL = new URL(this.getClass().getResource(this.getClass().getSimpleName() +".class"),file.toString());
String endpoint = "https://<machine>:8443/axl/";
AXLAPIService ss = new AXLAPIService(wsdlURL);
以下是错误我看到上执行此 -
Failed to access the WSDL at: file:/blah/blah/blah.jar!/AXLAPI.wsdl. It failed with:
/blah/blah/blah.jar!/AXLAPI.wsdl (No such file or directory).
我会很感激的任何建议,以处理这个!
文件不再是一个独立的文件 –
正确的。但作为感叹号表示我想要的JAR文件的相对路径。 jar -xvf显示我的wsdl文件在jar文件的根路径 – Chandan
这可能会有帮助 - http://stackoverflow.com/questions/5193786/how-to-use-classloader-getresources-correctly – ChadNC