java.lang.NullPointerException

Hibernate JIRA | ronald feng | 1 decade ago
  1. 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
  2. 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
  3. 0

    Unable to persist the data into database using Hibernate

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

    Automated exception search integrated into your IDE

    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.cfg.Mappings.getTypeDef()
    2. Hibernate
      Configuration.configure
      1. org.hibernate.cfg.Mappings.getTypeDef(Mappings.java:376)
      2. org.hibernate.cfg.HbmBinder.bindSimpleValueType(HbmBinder.java:1161)
      3. org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1129)
      4. org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:400)
      5. org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:343)
      6. org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:282)
      7. org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
      8. org.hibernate.cfg.Configuration.add(Configuration.java:386)
      9. org.hibernate.cfg.Configuration.addInputStream(Configuration.java:427)
      10. org.hibernate.cfg.Configuration.addResource(Configuration.java:482)
      11. org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1465)
      12. org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
      13. org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
      14. org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
      15. org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
      16. org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
      16 frames
    3. org.rzeus.hibernate
      TestSerializeAndTransient.main
      1. org.rzeus.hibernate.test.TestSerializeAndTransient.main(TestSerializeAndTransient.java:50)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    5. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)[/code]
      1 frame