Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemNotFoundException: Provider "gs" not installed #547

Closed
lordcoste opened this issue May 7, 2021 · 4 comments
Closed

FileSystemNotFoundException: Provider "gs" not installed #547

lordcoste opened this issue May 7, 2021 · 4 comments
Assignees
Labels
api: storage Issues related to the googleapis/java-storage-nio API. type: question Request for information or clarification. Not an issue.

Comments

@lordcoste
Copy link

lordcoste commented May 7, 2021

Hi, I'm getting this error on app engine standard java11:

java.nio.file.FileSystemNotFoundException: Provider "gs" not installed
    at java.base/java.nio.file.Path.of(Path.java:212)
    at java.base/java.nio.file.Paths.get(Paths.java:97)

Is there anything else I should do besides adding the dependency in the pom?

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-nio</artifactId>
  <version>0.122.13</version>
</dependency>

Best regards

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage-nio API. label May 7, 2021
@cojenco cojenco added the type: question Request for information or clarification. Not an issue. label May 7, 2021
@cojenco cojenco self-assigned this May 7, 2021
@cojenco
Copy link
Contributor

cojenco commented May 7, 2021

Hi @lordcoste, thanks for filing the question. The google-cloud-nio artifact ships a scheme handler for gs URI. We do recommend deferring to libraries-bom for the version as is shown in the first sample here. If you can try that out, and see if you still run into the exception.

@lordcoste
Copy link
Author

Hi @cojenco, thanks for you help. I've tried also with BOM but I've got the same error. If it can help to debug the issue: if I extract the resulting jar after building it with maven, I can see the BOOT-INF/lib/google-cloud-nio-0.122.13.jar

I'm not an expert java dev, I'm just trying to port an existing springboot microservice to google cloud. Right now everything is working (for example: com.google.cloud.sql) except the storage. Is there anything else I can try?

@averikitsch
Copy link

Hi @lordcoste , it looks like the conventional Spring boot packaging here isn't packaging the dependency in the needed way. Usually you'll see something like:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>2.4.5</version>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

However, for the "gs" provider to be accessible it needs to be in the 'lib/' folder. You can package it manually by copying the dependencies and then creating the JAR (this is based on the springboot-helloworld sample:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
      <execution>
          <id>copy-dependencies</id>
          <phase>prepare-package</phase>
          <goals>
              <goal>copy-dependencies</goal>
          </goals>
          <configuration>
              <outputDirectory>
                  ${project.build.directory}/lib
              </outputDirectory>
          </configuration>
      </execution>
  </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
    <archive>
        <manifest>
            <addClasspath>true</addClasspath>
            <classpathPrefix>lib/</classpathPrefix>
            <mainClass>
              com.example.appengine.springboot.SpringbootApplication
            </mainClass>
        </manifest>
    </archive>
</configuration>
</plugin>

@cojenco
Copy link
Contributor

cojenco commented May 20, 2021

Hope this helps, @lordcoste. Please reopen if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage-nio API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants