在类路径上检测到

在类路径上检测到

本文介绍了在类路径上检测到 log4j-over-slf4j.jar 和 slf4j-log4j12.jar,抢占 StackOverflowError.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用了 xuggle library 将视频从 mp4 转码为 flv.我也使用 slf4j 库 来支持日志记录结束.

I have used xuggle library in my project to trans code the video from mp4 to flv.I have used slf4j libraries also to support logging end.

import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.IMediaViewer;
import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.ToolFactory;

public class TranscodingExample {

    private static final String inputFilename = "E:\VIDEO\Facebook.mp4";
    private static final String outputFilename = "E:\VIDEO\Facebook.flv";

    public static void main(String[] args) {

        // create a media reader
        IMediaReader mediaReader =
               ToolFactory.makeReader(inputFilename);

        // create a media writer
        IMediaWriter mediaWriter =
               ToolFactory.makeWriter(outputFilename, mediaReader);

        // add a writer to the reader, to create the output file
        mediaReader.addListener(mediaWriter);

        // create a media viewer with stats enabled
        IMediaViewer mediaViewer = ToolFactory.makeViewer(true);

        // add a viewer to the reader, to see the decoded media
        mediaReader.addListener(mediaViewer);

        // read and decode packets from the source file and
        // and dispatch decoded audio and video to the writer
        while (mediaReader.readPacket() == null) ;

    }

}

这里出现错误

"Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.".

为了解决日志问题,我使用了两个 jar 文件作为库.有没有人遇到同样的问题.如果是这样,请写出建议或解决方案以摆脱困境.提前致谢.

I have used both jar files as libraries in order to solve logging problems.Does any one faced the same problem.If so kindly write suggestion or solution to come out of this mess.Thanks in advance.

推荐答案

所以你必须排除冲突依赖.试试这个:

So you have to exclude conflict dependencies. Try this:

<exclusions>
  <exclusion>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
  </exclusion>
  <exclusion>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
  </exclusion>
</exclusions>

这解决了与 slf4j 和 Dozer 相同的问题.

This solved same problem with slf4j and Dozer.

这篇关于在类路径上检测到 log4j-over-slf4j.jar 和 slf4j-log4j12.jar,抢占 StackOverflowError.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:46