1

I'm getting this exception, while starting my web application, that is running in the apache tomcat 6.0.29 Can any one help why am i getting error like this: How to resolve this. Please help me with the reason of getting this error

SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.oe.ws.beans.CardBean
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.oe.ws.beans.CardBean
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
    at java.util.ArrayList.readObject(ArrayList.java:696)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:988)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1865)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1475)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:977)
    at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
    at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
    at org.apache.catalina.session.StandardManager.start(StandardManager.java:643)
    at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4559)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.io.NotSerializableException: com.oe.ws.beans.CardBean
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
    at java.util.ArrayList.writeObject(ArrayList.java:673)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:959)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
    at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1551)
    at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:994)
    at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:523)
    at org.apache.catalina.session.StandardManager.unload(StandardManager.java:469)
    at org.apache.catalina.session.StandardManager.stop(StandardManager.java:673)
    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4774)
    at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
    at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1319)
    at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1290)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:323)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1086)
    at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
    at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:450)
    at org.apache.catalina.core.StandardService.stop(StandardService.java:587)
    at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
    at org.apache.catalina.startup.Catalina.stop(Catalina.java:648)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:615)
    ... 6 more
Beryllium
  • 12,164
  • 9
  • 52
  • 81
Mohan
  • 201
  • 3
  • 10
  • 1
    I guess you are trying to persist CardBean. was CardBean implements Serializable interface ? – upog Sep 26 '13 at 05:41
  • No .. It is not implemented.. and also why i need to implement that.. can you help me to understand bit more about this.. thanks – Mohan Sep 26 '13 at 05:46

1 Answers1

1

try to delete this:

${catalina.home}/work/Catalina/localhost/<app>/SESSION.ser where app is your application.

and restart again.

If that does not work or if u choose not to do that every time, make sure that ur Dao or other classes like CardBean must implement the java.io.Serializable interface if it is to be serialized (your stack trace indicates an attempt is made to write an instance of the class to an object stream).

The instance to be serialized, along with all objects in the object graph of that instance, must all be serializable.

From the javadocs for Serializable,

Serializability of a class is enabled by the class implementing the java.io.Serializable interface...When traversing a graph, an object may be encountered that does not support the Serializable interface. In this case the NotSerializableException will be thrown and will identify the class of the non-serializable object.

codeMan
  • 5,460
  • 2
  • 21
  • 49
  • So everytime, i need to delete this.? Is there any permanent solution.. – Mohan Sep 26 '13 at 05:43
  • @user2813855 I have edited my answer take look at it. – codeMan Sep 26 '13 at 05:46
  • @codeMan.. ok thanks.. let me go through your comments and ask you if any help needed – Mohan Sep 26 '13 at 05:55
  • so it means, i have to write all the classes with implements serializable? to avoid this kind of problem. is that implementing serialize for all the classes are recommended..? – Mohan Sep 26 '13 at 05:58
  • 1
    What ur server is trying to do is to save its state when u stop it. So that it can restore to the same state when u start it again. For that to happen, it is writing the objects into the file system. To be able to write the state of the objects to the file system, in java u need to implement Serializable. – codeMan Sep 26 '13 at 06:01
  • Serializable is a marker interface which means that u dont have to provide implementation for any methods, all u have to do is write public implements Serializable. – codeMan Sep 26 '13 at 06:03
  • oh ok .. thanks for the info. I'm very glad to get this info from you .. i got some points – Mohan Sep 26 '13 at 06:10
  • And i have another question. I have not did this implements serializable in so many classes of my project. By why this one class i'm getting error. It have to show all the classes am i right? or the server will not write all the classes to the file system? – Mohan Sep 26 '13 at 06:14
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/38072/discussion-between-codeman-and-user2813855) – codeMan Sep 26 '13 at 06:16