Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException at the SessionFactory create line.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple Chauhan wrote:
Paul Sturrock wrote:...adn what happens on line 46 of UserHibDao?


There is blank line on line number 46


Which means you are not running the code you have posted, because:

java.lang.NullPointerException
org.hns.user.dao.UserHibDao.insert(UserHibDao.java:46)

tells me there is a NullPointerException at line 46 of UserHibDao.
 
Sridhar Gudipalli
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please share the server log?

You are trying to close session in finally block. So, I suspect there is some exception and when the flow reaches to finally block after the exception, session might be null and calling session.close() may be causing NPE. Please look into your server log for more details. Also verify if the session is null in finally block before calling session.close().

Change the below block



To



And also I would add simple debug statements in try block and look into server log.

 
Sweta Chauhan
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:
Simple Chauhan wrote:
Paul Sturrock wrote:...adn what happens on line 46 of UserHibDao?


There is blank line on line number 46


Which means you are not running the code you have posted, because:

java.lang.NullPointerException
org.hns.user.dao.UserHibDao.insert(UserHibDao.java:46)

tells me there is a NullPointerException at line 46 of UserHibDao.


No I am running the code with eclipse editor that's why I am able to send you the server log. I know the NullPointerException is in the UseHibDao.java file at line number 46 that's just below the SessionFactory create statement.


Thanks for help
 
Sweta Chauhan
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all, now it's working fine actually I was using missing few jar files now it's working and able to store data to the table.
 
Sridhar Gudipalli
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surprising... Missing jar files caused NullPointerException? Shouldn't it cause ClassNotFoundException??
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic