| Author |
NullPointerException at the SessionFactory create line.
|
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
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:
tells me there is a NullPointerException at line 46 of UserHibDao.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Sridhar Gudipalli
Ranch Hand
Joined: Nov 02, 2005
Posts: 120
|
|
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.
|
Sridhar Gudipalli|SCJP 6.0
SCWCD objectives
|
 |
Sweta Chauhan
Ranch Hand
Joined: Jul 09, 2010
Posts: 53
|
|
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:
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
Joined: Jul 09, 2010
Posts: 53
|
|
|
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
Joined: Nov 02, 2005
Posts: 120
|
|
|
Surprising... Missing jar files caused NullPointerException? Shouldn't it cause ClassNotFoundException??
|
 |
 |
|
|
subject: NullPointerException at the SessionFactory create line.
|
|
|