1

I can't get hibernate connection worked !! I'm using Hibernate 4.2.1 I Got this error

Initial SessionFactory creation failed.org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration

public class HibernateUtil {

    private static final SessionFactory sessionFactory;
    private static ServiceRegistry serviceRegistry;

    static {
                   try {

                                   Configuration configuration = new Configuration();
                       configuration.configure();
                       serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
                       sessionFactory = configuration.buildSessionFactory(serviceRegistry);
                   } catch (Throwable ex) {
                                   System.err.println("Initial SessionFactory creation failed." + ex);
                                   throw new ExceptionInInitializerError(ex);
                   }
    }              

    public static SessionFactory getSessionFactory() {
                   return sessionFactory;
    }
}

Here My logs :

16 mai 2013 10:27:14 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
16 mai 2013 10:27:14 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.1.Final}
16 mai 2013 10:27:14 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
16 mai 2013 10:27:14 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
16 mai 2013 10:27:14 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace                     http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
16 mai 2013 10:27:15         org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
16 mai 2013 10:27:15     org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
16 mai 2013 10:27:15     org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
16 mai 2013 10:27:15 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/portail]
16 mai 2013 10:27:15 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=postgres, password=****}
16 mai 2013 10:27:15 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
16 mai 2013 10:27:15 org.hibernate.engine.jdbc.internal.LobCreatorBuilder     useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error :     java.lang.reflect.InvocationTargetException
16 mai 2013 10:27:15     org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
16 mai 2013 10:27:15 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Initial SessionFactory creation     failed.org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean     Validation integration
Hasta Dhana
  • 4,699
  • 7
  • 17
  • 26
Rollyng
  • 1,387
  • 2
  • 12
  • 18
  • 1
    What is the full stack trace of the error? Do you have Hibernate Validator and/or the Bean Validation API on the classpath and in which version? If you don't want to use Bean Validation you should neither have the API nor Hibernate Validator on the classpath. If you want to use it add both (Bean Validation 1.0 and Hibernate Validator 4.3.1.Final) – Hardy May 20 '13 at 07:38

1 Answers1

1

Fixed, I had to add Hibernate Validator

Rollyng
  • 1,387
  • 2
  • 12
  • 18