hope this help to you http://hardik4u.wordpress.com
Anoop-9 wrote:
>
> Hi,
> We are looking forward to integrating struts with hibernate in our web
> application project. Could you guide us on how to to integrate them. I
> tried the hibernate plugin as recommended on the hibernate website,
> however that throws a null pointer exception(when i try to instantiate
> a session) when i test it in tomcat.
>
> Relevant piece of code
> in struts-config.xml
> <plug-in
>
> className="de.laliluna.hibernate.plugin.HibernatePlugIn">
> <set-property
> property="configFilePath"
> value="/hibernate.cfg.xml" />
> <set-property
> property="storeInServletContext"
> value="true" />
>
> In struts action
> try{ServletContext context = request.getSession().getServletContext();
> SessionFactory _factory = (SessionFactory)
>
> context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
> Session ses = _factory.openSession(); <---this line
> throws exception
> --
> Anoop Dhanvijay
> DA-IICT
>
> "Most of man's failures were when they didn't realize how close they
> were to success, when they finally gave up!"
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Hibernate-and-Struts-tp19985981p20009546.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]