• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Null Pointer Exception @ SessionFactory

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to everyone,

I'm new to Hibernate. I just want to do a sample project with Hibernate. But I've been taking exceptions, I'll be happy if someone can help me..
Thanks in advance..

And here's my hibernate.cfg.xml file:

Full stacktrace:
 
author & internet detective
Posts: 40913
840
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Talha,
The exception says it is being thrown in line 30 in saveOrUpdate. Which line is line 30? If I had to guess, I would imagine it is one of the lines in the catch or finally block. You should have a null check so you aren't trying to rollback the transaction if it is null. In other words, if Hibernate fails on creating a session, the code throws a Null Pointer in the catch block and you don't know what the original exception is. The finally block should have a similar null check for session.
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Jeanne..

Now I'm taking another exception :

org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping clazz="model.Users"/>

Here's my Users class that is generated Hibernate tools..

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic