aspose file tools
The moose likes JDBC and Relational Databases and the fly likes java.lang.ExceptionInInitializerError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java.lang.ExceptionInInitializerError" Watch "java.lang.ExceptionInInitializerError" New topic
Author

java.lang.ExceptionInInitializerError

Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 420
Hi!

This line: this.session = SessionFactoryUtil.getInstance().getCurrentSession();
gives the exception: Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError

The static initialization code in the SessionFactoryUtil class:


I took the class SessionFactoryUtil from here: http://www.laliluna.de/first-hibernate-example-tutorial.html

please, help me.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
You may want to put a try/catch block around those statements, and print the stack trace of the exception to your log file.
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 420
Ulf Dittmer wrote:You may want to put a try/catch block around those statements, and print the stack trace of the exception to your log file.

Thanks Ulf!

I did this:


And it prints:
17:34:49,282 INFO EntityBinder:424 - Bind entity com.tivrfoa.model.Meaning on table meanings
Unknown Id.generator: meanings_id_seq
Cause: null

I'm using PostgreSQL. The table meanings has a primary key called "meanings_pkey" and a sequence called "meanings_id_seq".

What should I try now?
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 420
I found the solution here in this site =)

http://www.coderanch.com/t/217781/Object-Relational-Mapping/java/Unknown-Id-generator-Hibernate-exception
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.lang.ExceptionInInitializerError