kekolab
kekolab

Reputation: 831

Starting up Hibernate 5 with jboss 7

I am facing a problem while using Hibernate 5.1.0 on JBoss 7.1.1-Final. It seems like it's related to the logging classes. Here it is my build.gradle file

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'

targetCompatibility = 1.7
sourceCompatibility = 1.7

repositories {
    jcenter()
    flatDir {
       dirs 'src/main/webapp/WEB-INF/lib'
   }
}

dependencies {
    compile 'org.springframework:spring-context:4.2.5.RELEASE'
    compile 'org.springframework:spring-web:4.2.5.RELEASE'
    compile 'org.springframework:spring-webmvc:4.2.5.RELEASE'
    compile 'org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.5'
    compile 'org.apache.cxf:cxf-rt-transports-http:3.1.5'
    compile 'org.apache.cxf:cxf-rt-rs-service-description:3.1.5'
    compile 'commons-httpclient:commons-httpclient:20020423'
    compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
    compile 'org.codehaus.jackson:jackson-jaxrs:1.9.13'

    compile project (':DaoCEOrder')
    compile 'org.hibernate:hibernate-core:5.1.0.Final'
    compile ':ojdbc6'
    compile 'log4j:log4j:1.2.17'
}

I get an exception at Hibernate initialisation:

11:25:38,191 INFO  [org.hibernate.Version] (http--10.23.47.96-8080-1) HHH000412: Hibernate Core {5.1.0.Final}
11:25:38,198 INFO  [org.hibernate.cfg.Environment] (http--10.23.47.96-8080-1) HHH000021: Bytecode provider name : javassist
11:25:38,506 INFO  [org.hibernate.annotations.common.Version] (http--10.23.47.96-8080-1) HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
11:25:38,585 WARN  [org.hibernate.orm.connections] (http--10.23.47.96-8080-1) HHH10001002: Using Hibernate built-in connection pool (not for production use!)
11:25:38,587 INFO  [org.hibernate.orm.connections] (http--10.23.47.96-8080-1) HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@/ENGINE]
11:25:38,588 INFO  [org.hibernate.orm.connections] (http--10.23.47.96-8080-1) HHH10001001: Connection properties: {user=, password=****, autocommit=true}
11:25:38,588 INFO  [org.hibernate.orm.connections] (http--10.23.47.96-8080-1) HHH10001003: Autocommit mode: true
11:25:38,591 ERROR [stderr] (http--10.23.47.96-8080-1) java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
11:25:38,592 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:34)
11:25:38,592 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:19)
11:25:38,593 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:138)
11:25:38,593 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:110)
11:25:38,594 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:74)
11:25:38,594 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
11:25:38,595 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
11:25:38,595 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
11:25:38,596 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
11:25:38,596 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
11:25:38,597 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
11:25:38,597 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
11:25:38,598 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
11:25:38,598 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208)
11:25:38,599 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
11:25:38,599 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
11:25:38,599 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
11:25:38,600 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
11:25:38,601 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
11:25:38,601 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
11:25:38,601 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
11:25:38,602 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
11:25:38,602 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
11:25:38,603 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
11:25:38,603 ERROR [stderr] (http--10.23.47.96-8080-1)  at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)
11:25:38,604 ERROR [stderr] (http--10.23.47.96-8080-1)  at it.tim.dao.ce.ceorder.H8Utils.getSessionFactory(H8Utils.java:61)

Everything works fine on Tomcat 7.x. Does anybody have any idea about how to overcome this issue?

Upvotes: 2

Views: 1333

Answers (1)

v.ladynev
v.ladynev

Reputation: 19966

You have an old hibernate-core-xxx.jar in your classpath. It can reside in the JBoss default libraries (modules).

For an example, JBoss AS 7.1.2 Final has Hibernate Core 4.1.3.Final, corresponding this

JBoss Enterprise Application Platform Component Details

Upvotes: 2

Related Questions