-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Deserialize Ejb3Configuration NullPointerException
PostPosted: Wed Jun 29, 2011 9:25 am 
Newbie

Joined: Wed Jun 29, 2011 8:41 am
Posts: 3
Hello,

I serialize an Ejb3Configuration. When I deserialize it, it return me a NullPointerException
Can anyone help me to find the solution

thanks

Code:
private void serializeEjb3Configuration(Column acfg) {
      FileOutputStream fos = null;
      ObjectOutputStream oos = null;
      try {
         fos = new FileOutputStream(FILE_SERIALIZE);
         oos = new ObjectOutputStream(fos);
         oos.writeObject(acfg);
         oos.flush();
         // log.info("Ejb3Configuration is serialized in : " +
         // FILE_SERIALIZE);
      } catch (IOException ioe) {
         log.info("Error : can't serialize the Ejb3Configuration in : "
               + FILE_SERIALIZE);
         ioe.printStackTrace();
      } finally {
         if (oos != null) {
            try {
               oos.close();
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
         if (fos != null) {
            try {
               fos.close();
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
      }
   }



Code:
private Column deserializeEjb3Configuration() {
      Column acfg = null;
      ObjectInputStream ois = null;
      FileInputStream fis = null;
      try {
         fis = new FileInputStream(FILE_SERIALIZE);
         ois = new ObjectInputStream(fis);
         try {
            acfg = (Column) ois.readObject();
         } catch (ClassNotFoundException e) {
            log.info("Error : can't read the Ejb3Configuration from : "
                  + FILE_SERIALIZE);
            e.printStackTrace();
         }

      } catch (IOException ioe) {
         log.info("Error : can't deserialize the Ejb3Configuration from : "
               + FILE_SERIALIZE);
         ioe.printStackTrace();
      } finally {
         if (ois != null) {
            try {
               ois.close();
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
         if (fis != null) {
            try {
               fis.close();
            } catch (IOException e) {
               e.printStackTrace();
            }
         }
      }
      return acfg;
   }



Code:
java.lang.NullPointerException
   at org.hibernate.mapping.Column.hashCode(Column.java:202)
   at java.util.AbstractList.hashCode(AbstractList.java:527)
   at org.hibernate.mapping.Table$ForeignKeyKey.hashCode(Table.java:69)
   at java.util.HashMap.putForCreate(HashMap.java:413)
   at java.util.HashMap.readObject(HashMap.java:1031)
   at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
   at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
   at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
   at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.