Maven冲突(java.lang.NoSuchMethodError:org.jboss.logging.Logger.getMessageLogger)

时间:2018-04-05 17:20:17

标签: java maven libraries conflict

我收到以下异常:

  

java.lang.NoSuchMethodError:   org.jboss.logging.Logger.getMessageLogger(Ljava /郎/类; Ljava /郎/字符串;)Ljava /郎/对象;   在   org.hibernate.ejb.Ejb3Configuration。(Ejb3Configuration.java:142)在   org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)

运行以下命令maven:

  

依赖:tree -Dverbose -Dincludes = org.jboss.logging

我得到了这个依赖树:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] fsp-parent
[INFO] fsp-commons
[INFO] fsp-model-entities
[INFO] fsp-model-services
[INFO] fsp-reports-core
[INFO] fsp-webapp-extras
[INFO] fsp-webapp
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-parent 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-parent ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-commons 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-commons ---
[INFO] com.lighthousebcs:fsp-commons:jar:2.3.2-FINAL
[INFO] +- org.jboss.cache:jbosscache-core:jar:3.2.7.GA:compile
[INFO] |  \- org.jboss:jboss-common-core:jar:2.2.14.GA:compile
[INFO] |     \- org.jboss.logging:jboss-logging-spi:jar:2.0.5.GA:compile
[INFO] \- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO]    +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO]    \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO]       \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-model-entities 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-model-entities ---
[INFO] com.lighthousebcs:fsp-model-entities:jar:2.3.2-FINAL
[INFO] +- com.lighthousebcs:fsp-commons:jar:2.3.2-FINAL:compile
[INFO] |  \- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.7.Final:compile
[INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- org.hibernate:hibernate-c3p0:jar:4.1.7.Final:compile
[INFO] |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] \- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-model-services 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-model-services ---
[INFO] com.lighthousebcs:fsp-model-services:jar:2.3.2-FINAL
[INFO] +- com.lighthousebcs:fsp-commons:jar:2.3.2-FINAL:compile
[INFO] |  \- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- com.lighthousebcs:fsp-model-entities:jar:2.3.2-FINAL:compile
[INFO] |  \- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] +- com.lighthousebcs:fsp-model-entities:test-jar:tests:2.3.2-FINAL:test
[INFO] |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:test - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.7.Final:compile
[INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] \- org.hibernate:hibernate-c3p0:jar:4.1.7.Final:compile
[INFO]    \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-reports-core 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-reports-core ---
[INFO] com.lighthousebcs:fsp-reports-core:jar:2.3.2-FINAL
[INFO] +- com.lighthousebcs:fsp-commons:jar:2.3.2-FINAL:compile
[INFO] |  \- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO] |     +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |     \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] |        \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- com.lighthousebcs:fsp-model-entities:jar:2.3.2-FINAL:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:4.1.7.Final:compile
[INFO] |  |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |  +- org.hibernate:hibernate-c3p0:jar:4.1.7.Final:compile
[INFO] |  |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |  \- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] \- com.lighthousebcs:fsp-model-entities:test-jar:tests:2.3.2-FINAL:test
[INFO]    \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:test - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-webapp-extras 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-webapp-extras ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building fsp-webapp 2.3.2-FINAL
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ fsp-webapp ---
[INFO] com.lighthousebcs:fsp-webapp:war:2.3.2-FINAL
[INFO] +- com.lighthousebcs:fsp-commons:jar:2.3.2-FINAL:compile
[INFO] |  \- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- com.lighthousebcs:fsp-model-entities:jar:2.3.2-FINAL:compile
[INFO] |  \- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] +- com.lighthousebcs:fsp-model-entities:test-jar:tests:2.3.2-FINAL:test
[INFO] |  \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:test - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] +- org.jboss.cache:jbosscache-core:jar:3.2.7.GA:compile
[INFO] |  \- org.jboss:jboss-common-core:jar:2.2.14.GA:compile
[INFO] |     \- org.jboss.logging:jboss-logging-spi:jar:2.0.5.GA:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.7.Final:compile
[INFO] |  +- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] |     \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] \- org.hibernate:hibernate-c3p0:jar:4.1.7.Final:compile
[INFO]    \- (org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile - version managed from 3.1.0.CR2; omitted for duplicate)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] fsp-parent ......................................... SUCCESS [  1.158 s]
[INFO] fsp-commons ........................................ SUCCESS [  1.238 s]
[INFO] fsp-model-entities ................................. SUCCESS [  1.507 s]
[INFO] fsp-model-services ................................. SUCCESS [  0.435 s]
[INFO] fsp-reports-core ................................... SUCCESS [  1.202 s]
[INFO] fsp-webapp-extras .................................. SUCCESS [  0.091 s]
[INFO] fsp-webapp ......................................... SUCCESS [  1.552 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.642 s
[INFO] Finished at: 2018-04-05T17:54:31+01:00
[INFO] Final Memory: 24M/332M
[INFO] ------------------------------------------------------------------------

我怎样才能读到这个,找到罪魁祸首并修复我的pom.xml? 请记住,hibernate使用 org.jboss.logging:JBoss的日志记录:罐:3.1.0.GA

感谢

1 个答案:

答案 0 :(得分:0)

你只需要在编译时保留org.jboss.logging:jboss-logging:jar:3.1.0.GA的每个depdency中排除传递依赖。如下所示,您可以排除。

   <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-c3p0</artifactId>
      <version>4.1.7.Final</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>  
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>
          <version>3.1.0.GA</version>    
        </exclusion>
      </exclusions> 
    </dependency>

显然你需要在你的pom.xml中添加org.jboss.logging:jboss-logging:jar:3.1.0.GA depedncy

   <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>
        <version>3.1.0.GA</version>    
    </dependency>