【发布时间】:2018-11-02 19:37:23
【问题描述】:
JarURLConnection.connect 当 JAR 文件包含 + 字符时抛出 FileNotFoundException。
在 /Users/pp/git/Repo/build/libs/repo-1.1.0+1.jar 中找不到 JAR 条目 BOOT-INF/classes!/sam.wsdl
服务存储库:
import java.io.IOException;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import org.springframework.core.io.ClassPathResource;
public class SampleService extends Service {
public SampleService() throws IOException {
super(new ClassPathResource("sam.wsdl", SampleService.class.getClassLoader()).getURL(), new QName("qname", "serv"));
}
}
当new ClassPathResource("sam.wsdl", SampleService.class.getClassLoader()).getURL() 解析为 URL 时,此代码运行良好
jar:file:/Users/pp/git/Repo/build/libs/repo-1.1.0.jar!/BOOT-INF/classes!/sam.wsdl
但是当我的 jar 包含 + 时会抛出 FNF 异常。
jar:file:/Users/pp/git/Repo/build/libs/repo-1.1.0+1.jar!/BOOT-INF/classes!/sam.wsdl
【问题讨论】:
标签: java web-services spring-boot