java.lang.ExceptionInInitializerError

journaldev.com | 3 months ago
  1. 0

    Hibernate Tutorial For Beginners - JournalDev

    journaldev.com | 3 months ago
    java.lang.ExceptionInInitializerError
  2. 0

    Unable to persist the data into database using Hibernate

    Stack Overflow | 4 years ago | developer
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    [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]

    Hibernate JIRA | 1 decade ago | ronald feng
    java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.internal.util.ConfigHelper.getResourceAsStream()
    2. Hibernate
      Configuration.configure
      1. org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
      2. org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2093)
      3. org.hibernate.cfg.Configuration.configure(Configuration.java:2074)
      3 frames
    3. main.java.com
      HibernateUtil.buildSessionFactory
      1. main.java.com.journaldev.hibernate.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:27)
      1 frame