Pregunta

Im trying to use truevfs library from application deployed on glassfish 4. Below code works excelent if used in a standalone java-se app, but it fails to look up the filesystem provider when used from inside glassfish.

Is this suposed to work? what are my options?

The code:

Path uriPath = new TPath(new URI("http://localhost:8080/mytar.tar"));

try (FileSystem zipfs = FileSystems.newFileSystem(uriPath, null)) {
    Path pathInZipfile = zipfs.getPath("/");    // <-- error thrown here
    ...
}

The pom:

<dependency>
    <groupId>net.java.truevfs</groupId>
    <artifactId>truevfs-profile-default</artifactId>
    <version>0.10.4</version>
    <type>pom</type>
</dependency>

and the error:

Caused by: java.nio.file.ProviderNotFoundException: Provider not found
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:403)
¿Fue útil?

Solución

i Put the question to truevfs mailing-list and the author of the library answered:

not sure if it has anything to do with that, but using FileSystems.newFileSystem(Path) is not required. Just pass the TPath object to any of the Files.* methods.

And he is right, using the Files.* methods directly on the TPath objects worked well.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top