question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoSuchMethodError when starting Torch Serve

See original GitHub issue

I keep getting this path not found error.

This is from starting the torchserve inside a project:

torchserve --start --model-store model_store --models densenet161=densenet161.mar

% java.lang.NoSuchMethodError: java.nio.file.Files.readString(Ljava/nio/file/Path;)Ljava/lang/String;
	at org.pytorch.serve.util.ConfigManager.readFile(ConfigManager.java:196)
	at org.pytorch.serve.util.ConfigManager.<init>(ConfigManager.java:108)
	at org.pytorch.serve.util.ConfigManager.init(ConfigManager.java:246)
	at org.pytorch.serve.ModelServer.main(ModelServer.java:70)

This is from after pulling and building torchserve from git, and running the torchserve_sanity.sh script:

> Task :modelarchive:test
objc[37989]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java (0x10b9184c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10b9924e0). One of the two will be used. Which one is undefined.

ModelArchiverSuite > TorchServe > org.pytorch.serve.archive.CoverageTest > test PASSED

ModelArchiverSuite > TorchServe > org.pytorch.serve.archive.ModelArchiveTest > test PASSED

ModelArchiverSuite > TorchServe > org.pytorch.serve.archive.ModelArchiveTest > testInvalidURL PASSED

ModelArchiverSuite > TorchServe > org.pytorch.serve.archive.ModelArchiveTest > testMalformURL PASSED

> Task :server:compileJava FAILED
/Users/hariharan/Petprojects/torchserve/serve/frontend/server/src/main/java/org/pytorch/serve/util/ConfigManager.java:196: error: cannot find symbol
        return Files.readString(Paths.get(path));
                    ^
  symbol:   method readString(Path)
  location: class Files
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':server:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
18 actionable tasks: 18 executed
Frontend build suite execution failed!!! Check logs for more details

Any ideas or help here please? Also, here’s my environment info:

Mac OSX Catalina 10.15.4 (19E287)

% python --version
Python 3.7.4

torch                    1.5.1
torch-model-archiver     0.1.1
torchserve               0.1.1
torchtext                0.6.0
torchvision              0.6.1

% java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
dhaniram-kshirsagarcommented, Jun 23, 2020

You need java 11 for this. Please look at the quick start guide here

3reactions
SysuCharoncommented, Dec 29, 2020

@SysuCharon: Could you please log a fresh ticket with your environment details per the bug report template? @harshbafna thank u I have solved this problem Install JDK first and then torch serve

Read more comments on GitHub >

github_iconTop Results From Across the Web

2. Troubleshooting Guide - PyTorch
2.1.2. “java.lang.NoSuchMethodError” when starting Torchserve.[473] ... This error usually occurs when Java 17 is not installed or used. Java 17 is required by ......
Read more >
1 - Stack Overflow
Error:Internal error : (java.lang.NoSuchMethodError) java.nio.file.Files.lines(Ljava/nio/file/Path;)Ljava/util/stream/Stream; java.lang.
Read more >
java.lang.NoSuchMethodError: 'net.minecraft.tags ...
Time: 19/05/2022, 23:25 Description: Starting integrated server java.lang.NoSuchMethodError: 'net.minecraft.tags.
Read more >
Exception in thread main java.lang.NoSuchMethodError
The server failed to start. Exception in thread main java.lang.NoSuchMethodError: java.nio.file.Path.of(Ljava/lang/String;[Ljava/lang/String ...
Read more >
CameraManager - Android Developers
A callback for camera flash torch modes becoming unavailable, disabled, ... Also starting with API level 29, while most basic camera information is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found