Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 连接到XDB时出现异常_Java_Influxdb - Fatal编程技术网

Java 连接到XDB时出现异常

Java 连接到XDB时出现异常,java,influxdb,Java,Influxdb,我尝试在Java代码中连接influxDb:influxDb influxDb=InfluxDBFactory.connect(“http://serverIp:8086“,”管理“,”管理“); 我得到错误: Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/Interceptor at org.influxdb.InfluxDBFactory.connect(InfluxDBFactory.java

我尝试在Java代码中连接influxDb:influxDb influxDb=InfluxDBFactory.connect(“http://serverIp:8086“,”管理“,”管理“); 我得到错误:

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
我在pom中使用Maven和依赖项:

   <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>

org.xdb
xdbjava
2.7
系统
${project.basedir}/src/main/resources/lib/influxdb-java-2.7.jar

okhttp3依赖项需要添加什么?或者如何解决这个问题

您缺少
com.squareup.okhttp3
依赖项。事实上,根据Maven Repository,XDB依赖项本身有一组编译依赖项

请参阅以获取这些内容的完整列表