Hibernate 创建SessionFactory失败,怎么回事?
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
Configuration config = new Configuration().configure();
sessionFactory = config.buildSessionFactory();// 执行到这步就出错了
} catch (Throwable ex) {
ex.printStackTrace();
throw new
ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession() throws
HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet