java.nio.file.FileSystemNotFoundException:Provider';wsjar';未安装

java.nio.file.FileSystemNotFoundException:Provider';wsjar';未安装,java,websphere,Java,Websphere,由于找不到正确的文件路径,我收到此异常报告 Caused by: java.nio.file.FileSystemNotFoundException: Provider "wsjar" not installed at java.nio.file.Paths.get(Paths.java:158) 我正在运行WebSphereV8.5.5.0 我这样称呼这条路: Class<?> clazz = ... URI uri = clazz.getResource("/proje

由于找不到正确的文件路径,我收到此异常报告

Caused by: java.nio.file.FileSystemNotFoundException: Provider "wsjar" not installed
    at java.nio.file.Paths.get(Paths.java:158)
我正在运行WebSphereV8.5.5.0

我这样称呼这条路:

Class<?> clazz = ...
URI uri = clazz.getResource("/project.properties").toURI();
Path propertyFilePath = Paths.get(uri); //error here.

wsjar
是jar文件中条目的特定于websphere的URL协议

通过代码可以实现的一个解决方案是重构URL,如下所示:

 if (uri.getProtocol().startsWith("wsjar")) 
     URL updatedURL = new URL("jar", uri.getHost(), uri.getPort(), uri.getPath());
这里讨论了类似的问题。

URI没有
.getProtocol()
方法。另外,当我在新URL中输出这三个uri函数的状态时,我会得到
uri.getHost()==null、uri.getPort()=-1和uri.getPath()==null
。它应该是URL。URL=clazz.getResource(“/project.properties”);从这里你应该可以使用协议和其他方法。
 if (uri.getProtocol().startsWith("wsjar")) 
     URL updatedURL = new URL("jar", uri.getHost(), uri.getPort(), uri.getPath());