简体   繁体   English

jboss 错误:java.lang.NoSuchMethodError:org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V

[英]jboss error: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V

I'm trying to create a simple hello world java web application that is using JPA through hibernate and using JBoss 6.4.0 as application Server.我正在尝试创建一个简单的 hello world java web 应用程序,它通过休眠使用 JPA 并使用 JBoss 6.4.0 作为应用程序服务器。 The application has been created through maven.该应用程序是通过 maven 创建的。 Furthermore I'm using Intellij as an IDE.此外,我使用 Intellij 作为 IDE。 However when I run the application Server I receive the following error:但是,当我运行应用程序服务器时,我收到以下错误:

16:09:04,772 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 25) HHH000412: Hibernate Core {5.3.7.Final}
16:09:04,774 INFO  [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 25) HHH000206: hibernate.properties not found
16:09:04,970 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 25) HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
16:09:05,141 WARN  [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001002: Using Hibernate built-in connection pool (not for production use!)
16:09:05,145 INFO  [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/testdb]
16:09:05,146 INFO  [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001001: Connection properties: {user=smattes, password=****}
16:09:05,147 INFO  [org.hibernate.orm.connections.pooling] (ServerService Thread Pool -- 25) HHH10001003: Autocommit mode: false
16:09:05,150 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 25) MSC000001: Failed to start service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_191]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_191]
    at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_191]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:276)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:260)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:401)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:112)
    at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:75)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:100)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:94)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
    at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:179)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:119)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:904)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:935)
    at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
    ... 4 more

16:09:05,164 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014612: Operation ("deploy") failed - address: ([("deployment" => "javahelloworld")]) - failure description: {"JBAS014671: Failed services" => {"jboss.persistenceunit.javahelloworld#NewPersistenceUnit" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
    Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V"}}
16:09:05,179 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "javahelloworld.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.persistenceunit.javahelloworld#NewPersistenceUnit" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.javahelloworld#NewPersistenceUnit: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
    Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V"}}
16:09:05,211 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment javahelloworld (runtime-name: javahelloworld.war) in 42ms
16:09:05,213 INFO  [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report

The persistence.xml file is the following: persistence.xml 文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">

    <persistence-unit name="NewPersistenceUnit">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>jpa.AuthorsEntity</class>
        <class>jpa.UserEntity</class>
        <properties>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/testdb"/>
            <property name="hibernate.connection.driver_class" value="com.mysql.cj.jdbc.Driver"/>
            <property name="hibernate.connection.username" value="myusername"/>
            <property name="hibernate.connection.password" value="mypassword"/>
            <property name="hibernate.archive.autodetection" value="class"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hbm2ddl.auto" value="update"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.DB2400Dialect"/>
        </properties>
    </persistence-unit>
</persistence>

and the jpa.AuthorsEntity and jpa.UserEntity are two java Entity classes that correspond to the tables authors and user correspondingly. jpa.AuthorsEntity 和 jpa.UserEntity 是两个 java Entity 类,分别对应于表作者和用户。

Any help would be appreciated.任何帮助,将不胜感激。

Such errors are typically caused by having different versions of a library on the compile time and runtime classpath.此类错误通常是由在编译时和运行时类路径上具有不同版本的库引起的。

Application servers - such as JBoss - typically provide their own versions of the Hibernate libraries at runtime.应用服务器——比如 JBoss——通常在运行时提供它们自己的 Hibernate 库版本。 This version is then most likely incompatible with the compile time version specified in your POM.此版本很可能与 POM 中指定的编译时版本不兼容。

JBoss AS 6.4 only supports JPA spec 2. You can then either roll-back the compile time Hibernate version in your POM to be compatible with the runtime dependency supplied by JBoss or, if you really need JPA 2.1 features, tell JBoss you are bundling the Hibernate libraries with your app. JBoss AS 6.4 仅支持 JPA 规范 2。然后,您可以回滚 POM 中的编译时 Hibernate 版本以与 JBoss 提供的运行时依赖项兼容,或者,如果您确实需要 JPA 2.1 功能,请告诉 JBoss 您正在捆绑使用您的应用程序休眠库。

For the former approach, this document indicates EAP 6.4 supports Hibarnate 4.2.18.Final对于前一种方法,本文档表明 EAP 6.4 支持 Hibarnate 4.2.18.Final

https://access.redhat.com/articles/112673#EAP_6 https://access.redhat.com/articles/112673#EAP_6

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>4.2.18.Final</version>
    <!-- Don't bundle in the WAR as provided by the server -->
    <scope>provided</scope> 
</dependency>

Check there are no hibernate libs in the deployed war (as a result of transitive dependencies for example).检查部署的战争中没有休眠库(例如,由于传递依赖关系)。

For the latter approach see here:对于后一种方法,请参见此处:

https://issues.jboss.org/browse/WFCORE-209?_sscc=t https://issues.jboss.org/browse/WFCORE-209?_sscc=t

for future readers, recently i had this issues, i had in the project the hibernate version 5.1 with glassfish 4.1 and it is generated this issues, for resolved i agregated in the WEB-INF folder the file glassfish-web.xml as i showing to continuation对于未来的读者,最近我遇到了这个问题,我在项目中使用了带有 glassfish 4.1 的 hibernate 版本 5.1 并且它生成了这个问题,为了解决我在 WEB-INF 文件夹中聚合了文件 glassfish-web.xml,因为我正在展示延续

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
    <class-loader delegate="false"/>
</glassfish-web-app>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由以下原因引起的:java.lang.NoSuchMethodError:org.hibernate.internal.CoreMessageLogger.debugf(Ljava / lang / String; II)V-在Spring REST示例中 - Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;II)V - in Spring REST example NoSuchMethodError:org.hibernate.internal.CoreMessageLogger.debugf(Ljava / lang / String; I)V - NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V Hibernate + Spring:java.lang.NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V - Hibernate + Spring: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V Hibernate 5 + Glassfish 4.1.1:java.lang.NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V - Hibernate 5 + Glassfish 4.1.1: java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V 休眠5 Infinispan:java.lang.NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V - Hibernate 5 Infinispan :java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V java.lang.NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V WebLogic部署 - java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V WebLogic deployment NoSuchMethodError:org.jboss.logging.Logger.debugf(Ljava / lang / String; I)V - NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;I)V java.lang.NoSuchMethodError:org.quartz.Scheduler.deleteTrigger(Ljava/lang/String;Ljava/lang/String;)V - java.lang.NoSuchMethodError:org.quartz.Scheduler.deleteTrigger(Ljava/lang/String;Ljava/lang/String;)V Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf - Hibernate 5 java.lang.NoSuchMethodError org.jboss.logging.Logger.debugf java.lang.NoSuchMethodError:org.jboss.logging.Logger.getMessageLogger(Ljava / lang / Class; Ljava / lang / String;)Ljava / lang / Object; - java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM