• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HHH000412: Hibernate Core {4.3.0.Final}

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of hibernate are you using?
 
Antraa Sethi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate 4.3.0 final
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic