java.lang.ExceptionInInitializerError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hibernate Tutorial For Beginners - JournalDev
    via by Unknown author,
  • [code] Configuration configuration=null; try { Configuration configurationSerializable = new Configuration(); FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(configurationSerializable); oos.flush(); oos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } try { FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); configuration = (Configuration) ois.readObject(); ois.close(); } catch (FileNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (ClassNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } if(configuration!=null) { SessionFactory sessionFactory = configuration.configure().buildSessionFactory(); } } [/code] protected transient Map typeDefs; the typeDefs will be null after deserializing. [code]Exception in thread "main" java.lang.NullPointerException at org.hibernate.cfg.Mappings.getTypeDef(Mappings.java:376) at org.hibernate.cfg.HbmBinder.bindSimpleValueType(HbmBinder.java:1161) at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1129) at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:400) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:343) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153) at org.hibernate.cfg.Configuration.add(Configuration.java:386) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427) at org.hibernate.cfg.Configuration.addResource(Configuration.java:482) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390) at org.hibernate.cfg.Configuration.configure(Configuration.java:1310) at org.hibernate.cfg.Configuration.configure(Configuration.java:1296) at org.rzeus.hibernate.test.TestSerializeAndTransient.main(TestSerializeAndTransient.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)[/code]
    via by ronald feng,
  • [code] Configuration configuration=null; try { Configuration configurationSerializable = new Configuration(); FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(configurationSerializable); oos.flush(); oos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } try { FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); configuration = (Configuration) ois.readObject(); ois.close(); } catch (FileNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (ClassNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } if(configuration!=null) { SessionFactory sessionFactory = configuration.configure().buildSessionFactory(); } } [/code] protected transient Map typeDefs; the typeDefs will be null after deserializing. [code]Exception in thread "main" java.lang.NullPointerException at org.hibernate.cfg.Mappings.getTypeDef(Mappings.java:376) at org.hibernate.cfg.HbmBinder.bindSimpleValueType(HbmBinder.java:1161) at org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1129) at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:400) at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:343) at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282) at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153) at org.hibernate.cfg.Configuration.add(Configuration.java:386) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427) at org.hibernate.cfg.Configuration.addResource(Configuration.java:482) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390) at org.hibernate.cfg.Configuration.configure(Configuration.java:1310) at org.hibernate.cfg.Configuration.configure(Configuration.java:1296) at org.rzeus.hibernate.test.TestSerializeAndTransient.main(TestSerializeAndTransient.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)[/code]
    via by ronald feng,
  • NULL Pointer Exception in Hibernate
    via by John Miner Stevens,
  • when I migrate from hibernate3.0 to 3.3 I got the NPE
    via by Satyajit Bhadange,
  • hibernate error
    via by Mark Hughes,
    • java.lang.ExceptionInInitializerError at main.java.com.journaldev.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:40) at main.java.com.journaldev.hibernate.util.HibernateUtil.getSessionFactory(HibernateUtil.java:99) at main.java.com.journaldev.hibernate.main.HibernateMain.main(HibernateMain.java:19) Caused by: java.lang.NullPointerException at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2093) at org.hibernate.cfg.Configuration.configure(Configuration.java:2074) at main.java.com.journaldev.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:27)
    No Bugmate found.