Mark, I have a simpler approach for Hibernate (v2.0.3 or v2.1 under Struts v1.0 or v1.1)
1. Start with the Hibernate example Struts PlugIn code and struts-config.xml configuration text at: http://www.hibernate.org/105.html 2. Do NOT put any context entries in server.xml or web.xml! 3. Choose any name OTHER than the example "java:comp/env/jdbc/mn-test". Any name under "java:/comp" in Tomcat is read-only and cannot be used. I selected one using my initial and some related hibernate words "dgf:/hibernate/SessionFactory". Put that in your hibernate.cfg.xml file as the 'name="..."' parameter of the session-factory tag, along the lines of this example: <session-factory name="dgf:/hibernate/SessionFactory"> <!-- properties --> <!-- mapping files --> <mapping resource="hibernate/Misc.hbm.xml"/> </session-factory> If you use a hibernate.properties file, what you need is described here: http://www.hibernate.org/hib_docs/api/net/sf/hibernate/cfg/Environment.html Since I use hibernate.cfg.xml instead of hibernate.properties, I'm guessing you'll need something like this in your hibernate.properties file: hibernate.jndi.url dgf:/hibernate hibernate.jndi.class javax.naming.Context hibernate.session_factory_name SessionFactory 4. Hibernate creates the non-existent JNDI context for me on webapp start and puts the session-factory in it. My facade class opens the session this way: Content ctx = new InitialContext(); SessionFactory sf = (SessionFactory) ctx.lookup(jndiLocation); Session session = sf.openSession(); That's all I do. Oh, I'm using hibernate 2.1beta6 now for my facade because it allows me to use named parameters in queries and hide the hibernate types more easily. (sorry, I think I read too much into Ted Husted's Struts in Action book, I'm trying to facade EVERYTHING! LOL). Feel free to email me off-list if you need futher help. Regards, David -----Original Message----- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Monday, November 24, 2003 12:32 AM To: Struts Users Mailing List Subject: Hibernate plugin After spending all night pissing around with various hibernate plugins to provide a datasource to use with hibernate? My JNDI datasource reports being okay in my container log, <Context path="/mn-test" docBase="mn-test" debug="5" reloadable="true" crossContext="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="mn-test" suffix=".log" timestamp="true" /> <Resource name="jdbc/mn-test" scope="Shareable" type="javax.sql.DataSource" /> <ResourceParams name="jdbc/mn-test"> .. then in my hibernate.cfg.xml <property name="connection.datasource"> java:comp/env/jdbc/mn-test </property> ... Every-time i try and get the datasource from the servlet context I get a null pointer exception.. While this of course is a life changing experience for me, i novelty is waring thin. If anyone has is working in reality , then any input would be greatly appreciated. Cheers Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]