buildSessionFactory « Exception « JPA Q&A





2. Error when buildSessionFactory()    forum.hibernate.org

3 entity class: PoliceStation -> Archive -> Policeman The 2 relations are both "one-to-many". Junit console: Code: .[INFO] Environment - -Hibernate 2.0.3 [INFO] Environment - -loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.connection.url=jdbc:mysql://localhost:3306/ps2003, hibernate.show_sql=true, hibernate.connection.provider_class=net.sf.hibernate.connection.DriverManagerConnectionProvider, hibernate.connection.password=, hibernate.statement_cache.size=25, hibernate.connection.pool_size=1} [INFO] Environment - -using java.io streams to persist ...

3. Error in EntityPersister class during buildSessionFactory()    forum.hibernate.org

I'm a beginner in Hibernate. I have a data model in my database (Oracle). I use Middlegen plug-in for Hibernate to generate the hbm xml mapping file from tables in the database. Then I use hbm2java to generate java classes from the mapping file. When I invoke buildsessionFactory to build the session factory object after configuration (by the configure.cfg.xml file), it ...

4. ClassCastException in KeyFactory in buildSessionFactory    forum.hibernate.org

using hibernate-2.1.4 + spring-1.1.1 + cglib-full-2.0.2 on Liferay portal. I get this weird exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [E:\PrgTools\liferay-tomcat-3.1.0\webapps\nccin\WEB-INF\hibernateSessionContext.xml]: Initialization of bean failed; nested exception is java.lang.ExceptionInInitializerError: null java.lang.ExceptionInInitializerError at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:768) at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:467) Caused by: java.lang.ClassCastException at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:235) Note the ClassCastException in KeyFactory. What could be the ...

5. buildSessionFactory raises exception ?!    forum.hibernate.org

Hi, I have a problem in buildSessionFactory. Hibernate 2.1.8. MySQL 4.1.7. Sun Java System Application Server 8.1 PE Configuration is as same as in the reference guide (chapter2, cat example). Using Util class mentioned in the reference guide; like static { sessionFactory = ... buildSessionFactory() } Here the exception I get: java.lang.ExceptionInInitializerError at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at ...

6. Error when executing buildSessionFactory()    forum.hibernate.org

Hi friends, I am using hibernate v2.1.6 with tomcat .I have configured everything necessary for hibernate environment. Here is the code snippet::: Configuration config = new Configuration(); config.configure(); SessionFactory sessionFactory =config.buildSessionFactory(); The error occurs on the last line i.e SessionFactory sessionFactory =config.buildSessionFactory(); On the console of exo-tomcat it gives me error: java.lang.ExceptionInInitializerError I m not getting any idea about this error.All ...

7. uncatchable Exception in buildSessionFactory    forum.hibernate.org

hi! when you build a SessionFactory for a Database that does not exist, an exception is thrown and logged. however, i can NOT catch that exception. what am i doing wrong? my code: try { Configuration cfg = HibernateSessionPool.buildConfiguration(ds); cfg.setProperty("hibernate.hbm2ddl.auto","create"); SessionFactory sf = cfg.buildSessionFactory(); } catch (Exception ex) { // Make sure you log the exception, as it might be swallowed ...

8. Exception during buildSessionFactory()    forum.hibernate.org

This is my Stacktrace : 08:54:02,889 INFO [STDOUT] In Test Facade 08:54:02,889 INFO [STDOUT] Initial SessionFactory creation failed.java.lang.NoC lassDefFoundError: org/hibernate/cfg/Configuration 08:54:02,905 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() for servlet action threw exception java.lang.ExceptionInInitializerError at de.xx.tutorial.hibernate.HibernateUtil.(Hibernate Util.java:17) at de.xx.tutorial.hibernate.TestFacade.doTheStuff(TestFacade .java:30) at de.xx.tutorial.hibernate.TestFacade.(TestFacade.jav a:24) at de.xx.tutorial.common.command.TutorialCommand.(Tuto rialCommand.java:19) at de.xx.tutorial.actions.TutorialAction.execute(TutorialAct ion.java:31) at org.apache.struts.action.RequestProcessor.processActionPerform(Reques tProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja va:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148 2) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) ...

9. Hibernate swallowing exceptions during buildSessionFactory    forum.hibernate.org

I am calling Code: try { this.sFactory = getConfiguration().buildSessionFactory(); int x = 5; ...





10. conf.buildSessionFactory() doesn't throw an Exception    forum.hibernate.org

WARN [SettingsFactory:109]: Could not obtain connection metadata java.sql.SQLException: Failed to start database 'jar:(c:\dbFile.jar)DBNAME', see the next exception for details. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection30.(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection40.(Unknown Source) at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) ...

11. Hibernate buildSessionFactory swallowing important exception    forum.hibernate.org

I'm using a HSQLDB in-process database with Hibernate - the app is a thick Swing client. If the data source is already open by some other process or application, and then my swing client tries to construct a SessionFactory in a fairly standard way: Code: sessionFactory = new Configuration(). ...