It's driving me insane! I have a tomcat webapp that uses Hibernation Configuration, the code below silently fails at Configuration cfg = new Configuration(); tomcat logs are not giving any error except my debugging statement right below where it fails (BEGIN STATIC!!!). No exception is thrown.. However when I packed the app into a jar, and runs the same method call in the main, it succeeds without error.
public class Manager { static Logger log = Logger.getLogger(Manager.class); public static SessionFactory sessionFactory; public static void main(String[]args){ System.out.println(getSessionFactory()); } public static SessionFactory getSessionFactory(){ if(sessionFactory==null){ System.out.println("BEGIN STATIC!!!!!!!! "); try{ Configuration cfg = new Configuration(); //FAILS SILENTLY System.out.println("BEGIN STATIC1"); //NOT PRINTED THEREAFTER cfg.configure("hibernate_xxx.xml"); System.out.println("BEGIN STATIC2"); cfg.addResource("xxx/persistence/xxx.xml"); System.out.println("BEGIN STATIC 3"); cfg.addResource("xxx/persistence/xxx.hbm.xml"); cfg.addResource("xxx/persistence/xxx.hbm.xml"); sessionFactory = cfg.buildSessionFactory(); }catch(Exception exp){ System.out.println("FUCK"); exp.printStackTrace(System.out); } System.out.println("END STATIC "); } return sessionFactory; }