Ola a todos.
estou com problema na hora de iniciar um SessionFactory, bom quando eu rodo o sistema por uma class main, apenas para teste, funciona tudo belezinha mas quando eu tento pelo tomcat da esse erro
estou usando TomCat 5.5 + JSF + HIBERNATE
Classe de teste com main
public class testar {
public static void main(String[] args) {
Session s = HibernateUtil.getSession();
Session b = HibernateUtil.getSession();
Transaction t = s.beginTransaction();
}
Classe do hibernate
public class HibernateUtil {
private static Log log = LogFactory.getLog(HibernateUtil.class);
private static Configuration configuration;
private static SessionFactory sessionFactory;
private static final ThreadLocal threadSession = new ThreadLocal();
private static final ThreadLocal threadTransaction = new ThreadLocal();
static {
try {
configuration = new Configuration();
sessionFactory = configuration.configure().buildSessionFactory();
} catch (Throwable ex) {
log.error("Building SessionFactory failed.", ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static Session getSession() {
Session s = (Session) threadSession.get();
if (s == null) {
log.debug("Opening new Session for this thread.");
s = getSessionFactory().openSession();
threadSession.set(s);
}
return s;
}
agradeco se alguem tiver alguma ideia do que seja