Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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.lang.NoSuchMethodError:okhttp3.internal.Platform.log和线程中的异常;“Okhttp调度程序”;java.lang.NoSuchFieldError:实例_Java_Http_Onvif - Fatal编程技术网

java.lang.NoSuchMethodError:okhttp3.internal.Platform.log和线程中的异常;“Okhttp调度程序”;java.lang.NoSuchFieldError:实例

java.lang.NoSuchMethodError:okhttp3.internal.Platform.log和线程中的异常;“Okhttp调度程序”;java.lang.NoSuchFieldError:实例,java,http,onvif,Java,Http,Onvif,请帮帮我。 我有okhttp3和logging interceptor 4.7.2版本。调用VIF getDeviceInformation时,我在“Okhttp Dispatcher”线程中有java.lang.NoSuchMethodError:okhttp3.internal.Platform.log。如果我设置了okhttp3 3.14.7版本,那么在“Okhttp Dispatcher”线程中会出现java.lang.NoSuchFieldError:INSTANCE 我有okhttp

请帮帮我。 我有okhttp3和logging interceptor 4.7.2版本。调用VIF getDeviceInformation时,我在“Okhttp Dispatcher”线程中有java.lang.NoSuchMethodError:okhttp3.internal.Platform.log。如果我设置了okhttp3 3.14.7版本,那么在“Okhttp Dispatcher”线程中会出现java.lang.NoSuchFieldError:INSTANCE

我有okhttp3和logging interceptor 4.7.2版本。我有java.lang.NoSuchMethodError:okhttp3.internal.Platform.log

这是一个依赖性问题, 您正在使用:

  • okhttp-4.7.2
  • logging-interceptor-4.7.2
  • okhttp-digest-2.0
  • 及 okhttp-digest-2.0的运行时依赖关系是okhttp-4.0.1

    Maven回购:

    现在您有了同一个库的两个不同版本

    1.来自okhttp-digest-2.0的okhttp-4.0.1

    2.okhttp-4.7.2

    日志函数发生了更改(这就是错误所说的NoSuchMethodError:okhttp3.internal.Platform.log),我们可以在图中看到

    解决方案

  • 您可以更新okhttp摘要的版本,该版本可以与okhttp-4.7.2一起使用
  • 如果您没有使用依赖于okhttl摘要的特性,那么可以从okhttl摘要中排除okhttp依赖项

  • 截至2020年10月26日,最新的《okhttp摘要》v2.5需要依赖关系


    对于okhttp摘要的未来版本,请确保检查等效的okhttp依赖项。

    如果项目不是maven,请共享您的POM或依赖项。以及引发此错误的代码行。@Darshana完成。添加pom和javacode@Darshana你为什么要删除你的答案。它起作用了!非常感谢。是的,我删除了它,因为我认为它没有帮助,现在取消删除。谢谢。我刚刚在DependenciesManager中设置了okhttp 4.0.1
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>prj.group.id</groupId>
    <artifactId>art.id</artifactId>
    <version>0.1.0</version>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.0.M4</version>
    </parent>
    
    <properties>
        <java-version>1.8</java-version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-messaging</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-websocket</artifactId>
            <version>5.2.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>javacv</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>ffmpeg</artifactId>
            <version>4.2.1-1.5.2</version>
        </dependency>
        <dependency>
            <groupId>org.bytedeco</groupId>
            <artifactId>ffmpeg-platform</artifactId>
            <version>4.2.1-1.5.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.12</version>
        </dependency>
        <dependency>
            <groupId>be.teletask.onvif</groupId>
            <artifactId>onvif</artifactId>
            <version>1.0.2</version>
        </dependency>
    </dependencies>
    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>4.7.2</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>logging-interceptor</artifactId>
                <version>4.7.2</version>
            </dependency>
            <dependency>
                <groupId>com.burgstaller</groupId>
                <artifactId>okhttp-digest</artifactId>
                <version>2.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.2.2.RELEASE</version>
            </plugin>
        </plugins>
    </build>
    
    <repositories>
        ***
    
    </repositories>
    
    <pluginRepositories>
        ***
    </pluginRepositories>
    
    OnvifManager manager = new OnvifManager();
    manager.setOnvifResponseListener( new OnvifResponseListener() {
    @Override
    public void onError(OnvifDevice device, int I, String s) {
    System.out.println(s);
    }
    ...
    });
    ...
    manager.getDeviceInformation(onvifDevice, (device, information) -> {
    // Don't reach this code
    information.getModel();
    });