IN THE CONTEXTLISTENER LIKE THIS :
public class StartUpListener implements ServletContextListener{
public void contextDestroyed(ServletContextEvent arg0) {
}
public void contextInitialized(ServletContextEvent arg0) {
try {
InitialContext ctx = new InitialContext();
HibernateUtil h = new HibernateUtil();
h.Init();
SessionFactory newsf = h.sf;
SessionFactory oldsf = (SessionFactory)ctx.lookup("hibernateJNDI");
System.out.println("bind hibernateJNDI~~~~~~~~~~~~~~~~~~~~~~~`");
if(oldsf!=null) ctx.rebind("hibernateJNDI", newsf);
else ctx.bind("hibernateJNDI", newsf);
} catch (NamingException e) {
e.printStackTrace();
}
}
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160878#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...