Stack Trace: Connection properties: {user=satbir, password=****} Jan 20, 2016 4:22:21 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false <[ServletContext@150083929[app:_auto_generated_ear_ module:pay.gov.bc.ca path:null spec-version:3.1], request: weblogic.servlet.internal.ServletRequestImpl@7012ee7d[ GET /http://ift.tt/1PiDf6N HTTP/1.1 Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, / Accept-Language: en-US Cache-Control: no-cache UA-CPU: AMD64 Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko Connection: Keep-Alive ]]
``Root cause of ServletException. java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V at org.hibernate.engine.jdbc.connections.internal.PooledConnections.(PooledConnections.java:34) at org.hibernate.engine.jdbc.connections.internal.PooledConnections.(PooledConnections.java:19) at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:138) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:110) at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:74) Truncated. see log file for complete stacktrace
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ License: GNU Lesser General Public
License (LGPL), version 2.1 or later.
~ See the lgpl.txt file in the root directory or
<http://ift.tt/1Mhi3Xp;.
-->
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://ift.tt/1fnOghG">
<hibernate-configuration>
<session-factory name="sessionFactory">
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="connection.username">satbir</property>
<property name="connection.password">orcl</property>
<!-- JDBC connection pool (use the built-in) -->
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">Update</property>
<!-- Names the annotated entity class -->
<mapping class="ca.bc.gov.model.AdminLabel"/>
<mapping class="ca.bc.gov.model.AdminTitle"/>
</session-factory>
</hibernate-configuration>
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.springframework.stereotype.Component;
@Component(value="hibernateUtils")
public class HibernateUtils
{
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory()
{
System.out.println("in hibernateUtils");
final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
.configure("ca/bc/gov/XML/hibernate.cfg.xml") // configures settings from hibernate.cfg.xml
.build();
try {
sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
}
catch (Exception e) {
// The registry would be destroyed by the SessionFactory,but we had trouble building the SessionFactory
// so destroy it manually.
StandardServiceRegistryBuilder.destroy( registry );
System.out.println("error is....................."+e.getStackTrace());
}
return sessionFactory;
}
protected void tearDown() throws Exception
{
if ( sessionFactory != null ) {
sessionFactory.close();
}
}
}
Aucun commentaire:
Enregistrer un commentaire