I am trying to use hibernate with
struts.
First, the datasource is OK because I can use traditional method: initialize context and lookup.
However,when I use hibernate method, it throws:
net.sf.hibernate.exception.GenericJDBCException: Cannot open connection
I traced down and found the error happens when I execute session.beginTransaction()
My code is like this:
sessionFactory = new Configuration().configure().buildSessionFactory();
session = sessionFactory.openSession();
System.out.println("session opened!"); //this can be printed out
transaction = session.beginTransaction();
Then after printing out "session opened", the exception is thrown.
Could anyone help me out? Thanks.