2 Replies Latest reply on Apr 9, 2006 1:32 AM by oliverchua

    SerializationException due to NullPointerException in Unsafe

    oliverchua Newbie

      Hi,

      I have a method in my stateless session bean

      public List<Unit> getUnitListWithNone() {
       List<Unit> l = this.getUnitList();
       Unit u = new Unit();
       u.setUnitCode(new Long(Unit.NONE));
       u.setUnitName("None");
       l.add(0, u);
       return l;
       }


      It works fine when I call it from my unit test remotely.
      Now, I'm integrating it with struts, but ejb is also called remotely, so the behavior should be the same.
      However, I'm getting an exception... SerializationException

      Anybody have an idea?

      Below is the stack trace of the problem.

      initial error:
      08:56:57,675 INFO [STDOUT] 08:56:57,675 INFO [MenuAction] getServletPath: /pag
      es/employee/employee/SearchEmployee.jsp
      08:56:59,207 WARN [RequestProcessor] Unhandled Exception thrown: class java.lan
      g.reflect.UndeclaredThrowableException
      08:56:59,207 ERROR [[action]] Servlet.service() for servlet action threw excepti
      on
      java.lang.reflect.UndeclaredThrowableException
       at $Proxy313.getUnitListWithNone(Unknown Source)
       at com.tougher.intranet.struts.employee.unit.UnitAction.search(UnitActio
      n.java:93)
       at com.tougher.intranet.struts.employee.unit.UnitAction.unspecified(Unit
      Action.java:73)
       at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchActio
      n.java:256)


      ...

      caused by:
      Caused by: org.jboss.serial.exception.SerializationException
       at org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWritePersister.java:134)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDe
      scriptionFromStreaming(ObjectDescriptorFactory.java:167)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDe
      scription(ObjectDescriptorFactory.java:55)
       at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.rea
      dObject(DataContainer.java:657)
       at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossOb
      jectInputStream.java:85)


      ...

      caused by:
      Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWrit
      ePersister.java:124)
       ... 39 more
      Caused by: java.lang.NullPointerException
       at org.jboss.serial.classmetamodel.UnsafeFieldsManager.setInt(UnsafeFiel
      dsManager.java:82)
       at org.jboss.serial.persister.RegularObjectPersister.defaultRead(Regular
      ObjectPersister.java:172)
       at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObj
      ectPersister.java:151)