2015-11-24 3 views
2

Я знаю, что есть много вопросов, как это в StackOverflow, но не могу понять, как решить мою проблему:путь Класс содержит несколько привязок SLF4J (не нашел)

Я пытаюсь использовать Logback, но когда я пытаюсь запустить мое приложение, я получаю эту ошибку:

SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/slf4j-log4j12-1.7.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 

Обратите внимание, что, как фактическое связывание вместо log4j и попытался начать log4j, но не нашел ни одного appenders.

Я знаю, что я должен исключить те библиотеки, которые используют log4j, я не могу понять, какие.

Я не могу использовать МВН зависимость: дерево, так как оно не связано с зависимостями с другими проектами, которые подразумеваемые

8 required artifacts are missing. 

Из «Dependency иерархии» вид в затмении, до сих пор не может найти их.

Вот мой pom.xml

<modelVersion>4.0.0</modelVersion> 
<parent> 
    <artifactId>floox</artifactId> 
    <groupId>com.i3tv</groupId> 
    <version>0.0.1-SNAPSHOT</version> 
</parent> 
<artifactId>floox-business</artifactId> 
<packaging>war</packaging> 
<name>Floox Business</name> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <io.spring.platform-version>1.1.1.RELEASE</io.spring.platform-version> 
    <!-- AssertJ is not a part of Spring IO platform, so the version must be 
     provided explicitly --> 
    <assertj-core-version>1.5.0</assertj-core-version> 
    <config.root>src/main/config</config.root> 
</properties> 
<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>io.spring.platform</groupId> 
      <artifactId>platform-bom</artifactId> 
      <version>${io.spring.platform-version}</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 
<dependencies> 
    <!-- Spring --> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
    </dependency> 
    <!-- Security --> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-config</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-web</artifactId> 
    </dependency> 
    <!-- View --> 
    <dependency> 
     <groupId>org.thymeleaf</groupId> 
     <artifactId>thymeleaf-spring4</artifactId> 
     <!-- Avoid org.hibernate.jpa.boot.archive.spi.ArchiveException: Could 
      not build ClassFile in Java 8 --> 
     <exclusions> 
      <exclusion> 
       <artifactId>javassist</artifactId> 
       <groupId>org.javassist</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>org.thymeleaf.extras</groupId> 
     <artifactId>thymeleaf-extras-springsecurity3</artifactId> 
    </dependency> 
    <!-- Persistence --> 
    <dependency> 
     <groupId>com.zaxxer</groupId> 
     <artifactId>HikariCP</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-orm</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <!-- Avoid issue #72 Could not initialize class org.thymeleaf.templateresolver.ServletContextTemplateResolver 
      due to 'validation is not supported' --> 
     <exclusions> 
      <exclusion> 
       <artifactId>pull-parser</artifactId> 
       <groupId>pull-parser</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <!-- Avoid: javax.validation.ValidationException: HV000183: Unable to load 
     'javax.el.ExpressionFactory' --> 
    <dependency> 
     <groupId>javax.el</groupId> 
     <artifactId>javax.el-api</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hsqldb</groupId> 
     <artifactId>hsqldb</artifactId> 
    </dependency> 
    <!-- Spring Data --> 
    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-jpa</artifactId> 
    </dependency> 
    <!-- Validation --> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-validator</artifactId> 
    </dependency> 
    <!-- Logging --> 
    < <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>ch.qos.logback</groupId> 
     <artifactId>logback-classic</artifactId> 
    </dependency> 
    <!-- @Inject --> 
    <dependency> 
     <groupId>javax.inject</groupId> 
     <artifactId>javax.inject</artifactId> 
    </dependency> 
    <!-- Servlet --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <!-- JSON --> 
    <dependency> 
     <groupId>com.fasterxml.jackson.core</groupId> 
     <artifactId>jackson-databind</artifactId> 
    </dependency> 
    <!-- Utilities --> 
    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
    </dependency> 
    <!-- Test --> 
    <dependency> 
     <groupId>org.assertj</groupId> 
     <artifactId>assertj-core</artifactId> 
     <version>${assertj-core-version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hamcrest</groupId> 
     <artifactId>hamcrest-core</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hamcrest</groupId> 
     <artifactId>hamcrest-library</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.objenesis</groupId> 
     <artifactId>objenesis</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>net.sf.dozer</groupId> 
     <artifactId>dozer</artifactId> 
     <version>5.5.1</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>engine-indexer-dto</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>temporal-hits-dto</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-cloudsearch</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-dto</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-aop</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-memcached</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-utils</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv</groupId> 
     <artifactId>floox-token</artifactId> 
     <version>${project.parent.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>com.i3tv.a3cms.social</groupId> 
     <artifactId>a3cms-social-user</artifactId> 
     <version>${social.version}</version> 
     <exclusions> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-web</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>de.javakaffee.msm</groupId> 
     <artifactId>msm-kryo-serializer</artifactId> 
     <version>1.9.0-RC1</version> 
     <scope>runtime</scope> 
    </dependency> 
</dependencies> 

<!-- Configuración de los perfiles --> 
<profiles> 
    <profile> 
     <id>local</id> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
     <build> 
      <resources> 
       <resource> 
        <directory>${config.root}/local</directory> 
        <includes> 
         <include>**/*</include> 
        </includes> 
       </resource> 
      </resources> 
     </build> 
     <properties> 
      <profile.name>local</profile.name> 
     </properties> 
    </profile> 
    <!-- <profile> --> 
    <!-- <id>pre</id> --> 
    <!-- <build> --> 
    <!-- <resources> --> 
    <!-- <resource> --> 
    <!-- <directory>${config.root}/pre</directory> --> 
    <!-- <includes> --> 
    <!-- <include>**/*</include> --> 
    <!-- </includes> --> 
    <!-- </resource> --> 
    <!-- </resources> --> 
    <!-- </build> --> 
    <!-- <properties> --> 
    <!-- <serverId>aeb-pro</serverId> --> 
    <!-- <applicationName>Flux</applicationName> --> 
    <!-- <environmentName>flux-pre</environmentName> --> 
    <!-- <cnamePrefix>flux-pre</cnamePrefix> --> 
    <!-- <s3Bucket>flux-pre</s3Bucket> --> 
    <!-- <profile.name>pre</profile.name> --> 
    <!-- </properties> --> 
    <!-- </profile> --> 
    <profile> 
     <id>pre</id> 
     <build> 
      <resources> 
       <resource> 
        <directory>${config.root}/pre</directory> 
        <includes> 
         <include>**/*</include> 
        </includes> 
       </resource> 
      </resources> 
     </build> 
     <properties> 
      <serverId>aeb-pre</serverId> 
      <applicationName>floox-PRE</applicationName> 
      <environmentName>flooxPre-env</environmentName> 
      <cnamePrefix>flooxpre-env</cnamePrefix> 
      <s3Bucket>fluxpre</s3Bucket> 
      <profile.name>pre</profile.name> 
     </properties> 
    </profile> 
    <profile> 
     <id>pro</id> 
     <build> 
      <resources> 
       <resource> 
        <directory>${config.root}/pro</directory> 
        <includes> 
         <include>**/*</include> 
        </includes> 
       </resource> 
      </resources> 
     </build> 
     <properties> 
      <serverId>aeb-pro</serverId> 
      <applicationName>Flux</applicationName> 
      <environmentName>flux-pro</environmentName> 
      <cnamePrefix>flux-pro</cnamePrefix> 
      <s3Bucket>flux-pro</s3Bucket> 
      <profile.name>pro</profile.name> 
     </properties> 
    </profile> 
</profiles> 
<!-- Fin de la configuración de los perfiles --> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat7-maven-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <path>/</path> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration> 
       <source>${java-version}</source> 
       <target>${java-version}</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.3</version> 
      <configuration> 
       <webResources> 
        <resource> 
         <directory>${config.root}/${profile.name}/ebextensions</directory> 
         <targetPath>.ebextensions</targetPath> 
        </resource> 
       </webResources> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>deploy</id> 
        <phase>deploy</phase> 
        <goals> 
         <goal>sources</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-resources-plugin</artifactId> 
      <version>2.7</version> 
      <configuration> 
       <encoding>${project.build.sourceEncoding}</encoding> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>br.com.ingenieux</groupId> 
      <artifactId>beanstalk-maven-plugin</artifactId> 
      <version>1.0.1</version> 
      <configuration> 
       <serverId>${serverId}</serverId> 
       <environmentName>${environmentName}</environmentName> 
       <region>eu-west-1</region> 
       <applicationName>${applicationName}</applicationName> 
       <s3Bucket>${s3Bucket}</s3Bucket> 
       <s3Key>${project.artifactId}/${project.build.finalName}-${maven.build.timestamp}.war</s3Key> 
       <cnamePrefix>${cnamePrefix}</cnamePrefix> 
       <solutionStack>64bit Amazon Linux running Tomcat 7</solutionStack> 
      </configuration> 
      <executions> 
       <execution> 
        <phase>deploy</phase> 
        <goals> 
         <goal>upload-source-bundle</goal> 
         <goal>create-application-version</goal> 
         <goal>update-environment</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

ответ

2

я, наконец, удалось очистить свои пути к классам благодаря dur

Проблема заключалась в том, что я пытался исключить log4j из моих зависимостей вместо этого slf4j банки.

Так и через иерархию зависимостей в Eclipse, я был в состоянии найти, какие библиотеки используют эту зависимость, а затем исключены с правой кнопки мыши и Исключить Maven артефакт на Решенной вкладке Зависимости.

что добавили этот код на ПОМ

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

И вуаля, все работало.

Смежные вопросы