gpt4 book ai didi

java - hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf

转载 作者:IT老高 更新时间:2023-10-28 20:53:02 33 4
gpt4 key购买 nike

我在使用 hibernate 5 部署 web 应用时遇到问题

Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V
at org.hibernate.internal.NamedQueryRepository.checkNamedQueries(NamedQueryRepository.java:149) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:759) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:490) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724) [hibernate-core-5.0.0.CR2.jar:5.0.0.CR2]
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439) [spring-orm-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) [spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 23 more

使用 Hibernate 4 一切正常。

我在第 149 行查看了类 NamedQueryRepository。该类以这种方式调用方法 debugf

        log.debugf( "Checking %s named HQL queries", namedQueryDefinitionMap.size() );

我看不到问题

这是我的依赖树

[INFO] ------------------------------------------------------------------------
[INFO] Building app Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ app---
[INFO] +- org.springframework:spring-aspects:jar:4.1.7.RELEASE:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- org.springframework:spring-tx:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.1.7.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.1.7.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework:spring-orm:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.1.7.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.1.7.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:4.1.7.RELEASE:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.0.0.CR2:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.0.CR2:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | \- org.jboss:jandex:jar:1.2.2.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.0.Final:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] | \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:5.0.0.CR2:compile
[INFO] | \- com.mchange:c3p0:jar:0.9.2.1:compile
[INFO] | \- com.mchange:mchange-commons-java:jar:0.2.3.4:compile
[INFO] +- org.primefaces:primefaces:jar:5.2.RC3:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.2:compile
[INFO] \- net.sourceforge.jtds:jtds:jar:1.2.8:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

最佳答案

在 glassfish 这个问题是由 glassfish 模块的依赖冲突引起的。如果您检查 glassfishdir/modules 中的 lib 列表,您会看到 boss-logging.jar。您可以将其删除并替换为最新的,例如 org.jboss.logging:jboss-logging:jar:3.3.0.Final。它对我有用。

关于java - hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31547015/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com