Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
- <hibernate-configuration>
- <session-factory>
- <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
- <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/projet_hibernate</property>
- <property name="hibernate.connection.username">postgres</property>
- <property name="hibernate.connection.password">password</property>
- <property name="connection_pool_size">1</property>
- <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- <property name="current_session_context_class">thread</property>
- <!-- Disable the second-level cache -->
- <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
- <property name="show_sql">true</property>
- <property name="hbm2ddl.auto">create</property>
- <mapping resource="bean/Lecteurs.hbm.xml"/>
- </session-factory>
- package util;
- import org.hibernate.SessionFactory;
- import org.hibernate.cfg.AnnotationConfiguration;
- //import org.hibernate.cfg.Configuration;
- public class HibernateUtil {
- public static final SessionFactory sessionFactory = buildSessionFactory();
- private static SessionFactory buildSessionFactory() {
- try {
- // Create the SessionFactory from hibernate.cfg.xml
- return new AnnotationConfiguration().configure().buildSessionFactory();
- }
- catch (Throwable ex) {
- // Make sure you log the exception, as it might be swallowed
- System.err.println("Initial SessionFactory creation failed." + ex);
- throw new ExceptionInInitializerError(ex);
- }
- }
- public static SessionFactory getSessionFactory(){
- return sessionFactory;
- }
- public static void shutdown() {
- // Close caches and connection pools
- getSessionFactory().close();
- }
- }
- Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
- Exception in thread "main" java.lang.ExceptionInInitializerError
- at util.HibernateUtil.buildSessionFactory(HibernateUtil.java:20)
- at util.HibernateUtil.<clinit>(HibernateUtil.java:9)
- at manager.LecteursManager.ajouterLecteur(LecteursManager.java:14)
- at test.Test_Main.main(Test_Main.java:18)
- Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/ReflectionManager
- at util.HibernateUtil.buildSessionFactory(HibernateUtil.java:14)
- ... 3 more
- Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager
- at java.net.URLClassLoader.findClass(Unknown Source)
- at java.lang.ClassLoader.loadClass(Unknown Source)
- at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
- at java.lang.ClassLoader.loadClass(Unknown Source)
- ... 4 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement