This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes how to get session from spring-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to get session from spring-config.xml" Watch "how to get session from spring-config.xml" New topic
Author

how to get session from spring-config.xml

indu iyengar
Ranch Hand

Joined: Jul 30, 2010
Posts: 115
Hi all, am getting null pointer exception when try to access session --

dispatcher servlet code is :::

code to access session


thanks ,
Indu
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
Indu

I don't see any configuration where the "mysessionFactory" bean is being injected into the sessionFactory field, thus you get the Null exception. Therefore, you need to lookup the bean "mysessionFactory" and set it in the sessionFactory field.

Ran Pleasant

Ran
indu iyengar
Ranch Hand

Joined: Jul 30, 2010
Posts: 115
Thanks Ran ... got it
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get session from spring-config.xml
 
Similar Threads
Dependency injection problem
exceptions in spring configuration file.
I am getting org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity:
Spring Cofiguratation error
org.springframework.beans.NotReadablePropertyException