• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HHH000412: Hibernate Core {4.3.0.Final}

 
Antraa Sethi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying a very basic example to start with hibernate. As I run the example, a nullpointerexception generates.

INFO: HHH000412: Hibernate Core {4.3.0.Final}
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.hibernate.cfg.Configuration.reset(Configuration.java:324)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
at org.ruchi.hibernate.HibernateTest.main(HibernateTest.java:19)
Caused by: java.lang.NullPointerException
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
... 4 more

Below is the code of hibernate.cfg.xml file. I tried validating it and there are no errors. Oracle DB conn string and everything is correct I checked.


Please help get over this problem and run the application with no hurdles.
Thanks in advance
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of hibernate are you using?
 
Antraa Sethi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate 4.3.0 final
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not made the jump to 4.3.0 yet but things have changed a bit. I would have a look at the examples from Java Persistence with Hibernate Second Edition EARLY ACCESS (2013, Hibernate 4.3, JPA 2.1)
This book is written by the creators of Hibernate.

Get them here:
http://jpwh.org/examples/

Specifically look at how things are bootstrapped now.

In the zip go to environment/src/main/java/org/jpwh/env/HiberateSetup.java


You can find a very simple cfg.xml in helloworld/src/test/resources

Make sure to note the DOCTYPE
 
Antraa Sethi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thank you for the help but I am still stuck there.
Tried with earlier versions hibernate too, but same error.

Thanks again
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the stacktrace, I think the hibernate.cfg.xml (or the .properties) file isn't found in the classpath. Where exactly have you placed it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic