pambrose/prometheus-proxy

question about java version

Closed this issue · 7 comments

hi,
Is there any requirement for Java version?
I run it by docker, it works.
But fail when run by command: java -jar prometheus-agent.jar --config nodes.conf.
It has the error like this:
06:04:46.631 INFO [BaseOptions.kt:169] - trustCertCollectionFilePath: [main] 06:04:46.632 INFO [AgentOptions.kt:121] - agent.internal.cioTimeoutSecs: 90.0s [main] 06:04:46.632 INFO [AgentOptions.kt:122] - agent.scrapeTimeoutSecs: 300s [main] Exception in thread "main" java.lang.NoClassDefFoundError: java/net/http/HttpConnectTimeoutException at io.prometheus.Agent.<init>(Agent.kt:69) at io.prometheus.Agent.<init>(Agent.kt:57) at io.prometheus.Agent$Companion.startSyncAgent(Agent.kt:278) at io.prometheus.Agent$Companion.main(Agent.kt:269) at io.prometheus.Agent.main(Agent.kt) Caused by: java.lang.ClassNotFoundException: java.net.http.HttpConnectTimeoutException at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 5 more c105[root@fuel prometheus-proxy]#

What happens if you type: java -jar prometheus-agent.jar --version

06:23:20.017 INFO [Agent.kt:276] - Version: 1.8.5 Release Date: 9/3/20 [main]
Version: 1.8.5 Release Date: 9/3/20
c105[root@fuel prometheus-proxy]#

java -version

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

I just downloaded the same version of prometheus-agent.jar to my machine and ran it with a conf file and it worked fine. Try running with 1.11 or 1.14 JDK. HttpConnectTimeoutException was added in 1.11

I will update the README.md to reflect that requirement

I'm sorry, but you mean I should use jdk1.11 or 1.14?

Yes. That will fix the problem.