0
我嘗試連接到influxDb在我的Java代碼:InfluxDB influxDB = InfluxDBFactory.connect("http://serverIp:8086", "admin", "admin");
我得到錯誤:
異常在連接到influxDb
Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/Interceptor
at org.influxdb.InfluxDBFactory.connect(InfluxDBFactory.java:47)
at InfluxDbConnector.main(InfluxDbConnector.java:15)
Caused by: java.lang.ClassNotFoundException: okhttp3.Interceptor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
我使用Maven和依賴於POM:
<dependency>
<groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId>
<version>2.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/influxdb-java-2.7.jar</systemPath>
</dependency>
什麼okhttp3依賴需要添加?或者如何解決這個問題?