java.nio.file.FileSystemNotFoundException:未安装提供程序'wsjar'

时间:2014-03-05 00:37:10

标签: java websphere

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

Caused by: java.nio.file.FileSystemNotFoundException: Provider "wsjar" not installed
    at java.nio.file.Paths.get(Paths.java:158)

我正在运行Websphere v8.5.5.0。

我正在调用这样的路径:

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

有人可以解释一下wsjar文件名的含义吗?以及我可以做些什么来解决这个错误?

P.S。一旦我使用System.out.println语句运行它,我将获得实际的uri.toString。

UPDATE:实际的URI字符串如下:

wsjar:file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer_1/profiles/AppSrv01/installedApps/AUSSYDCVTLJ007Node02Cell/myapp.ear/lib/core.jar!/project.properties

1 个答案:

答案 0 :(得分:2)

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

可以从您的代码中完成的一个解决方案是重建URL,如下所示:

 if (uri.getProtocol().startsWith("wsjar")) 
     URL updatedURL = new URL("jar", uri.getHost(), uri.getPort(), uri.getPath());

此处讨论的类似问题。 https://issues.apache.org/jira/browse/XW-669