Jetspeed 2
  1. Jetspeed 2
  2. JS2-1005

NotSerializationException during restarting tomcat

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Tomcat 6.0.18

      Description

      May 12, 2009 10:21:13 AM org.apache.catalina.session.StandardManager doLoad
      SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.jetspeed.profiler.impl.JetspeedProfilerImpl
      java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.jetspeed.profiler.impl.JetspeedProfilerImpl
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
      at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1441)
      at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:942)
      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:637)
      at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
      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:525)
      at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
      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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: java.io.NotSerializableException: org.apache.jetspeed.profiler.impl.JetspeedProfilerImpl
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
      at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1517)
      at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:959)
      at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:517)
      at org.apache.catalina.session.StandardManager.unload(StandardManager.java:463)
      at org.apache.catalina.session.StandardManager.stop(StandardManager.java:667)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4519)
      at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:924)
      at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1191)
      at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1162)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:313)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      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:448)
      at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
      at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
      at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
      at org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.java:671)

        Activity

        Hide
        Woonsan Ko added a comment -

        Randy, would you fix this problem? I think you are the expert on this.

        To reproduce this problem:
        (1) Start tomcat (I used `./catalina.sh run')
        (2) Just browse the default page
        (3) Stop tomcat (I used Ctrl+C)
        (4) Start tomcat again and the error comes out.

        I found that the problematic session attribute was set in JetspeedProfilerImpl#setupProfilerContext(). (#809)
        The ProfilerContext is a member class, so it will have a reference to its JetspeedProfilerImpl instance which is not serializable. That's why the serialization fails.
        By the way, I detected problematic session attribute with a simple HttpSessionAttributeListener which tries to write object when added or replaced. For example,

        package org.apache.jetspeed.engine;

        import java.io.ByteArrayOutputStream;
        import java.io.IOException;
        import java.io.ObjectOutputStream;

        import javax.servlet.http.HttpSessionAttributeListener;
        import javax.servlet.http.HttpSessionBindingEvent;

        public class SessionAttributeChecker implements HttpSessionAttributeListener
        {
        public void attributeAdded(HttpSessionBindingEvent arg0)

        { checkAttributeSerializable(arg0); }

        public void attributeRemoved(HttpSessionBindingEvent arg0)
        {
        }

        public void attributeReplaced(HttpSessionBindingEvent arg0)
        { checkAttributeSerializable(arg0); }

        private void checkAttributeSerializable(HttpSessionBindingEvent arg0)
        {
        ObjectOutputStream oos = null;

        try

        { oos = new ObjectOutputStream(new ByteArrayOutputStream(512)); oos.writeObject(arg0.getValue()); }

        catch (IOException e)

        { System.out.println(">>> Not serializable session object: " + arg0.getName() + " = " + arg0.getValue()); e.printStackTrace(System.out); }

        finally
        {
        try

        { oos.close(); }

        catch (Exception ce) { }
        }
        }
        }

        Show
        Woonsan Ko added a comment - Randy, would you fix this problem? I think you are the expert on this. To reproduce this problem: (1) Start tomcat (I used `./catalina.sh run') (2) Just browse the default page (3) Stop tomcat (I used Ctrl+C) (4) Start tomcat again and the error comes out. I found that the problematic session attribute was set in JetspeedProfilerImpl#setupProfilerContext(). (#809) The ProfilerContext is a member class, so it will have a reference to its JetspeedProfilerImpl instance which is not serializable. That's why the serialization fails. By the way, I detected problematic session attribute with a simple HttpSessionAttributeListener which tries to write object when added or replaced. For example, package org.apache.jetspeed.engine; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingEvent; public class SessionAttributeChecker implements HttpSessionAttributeListener { public void attributeAdded(HttpSessionBindingEvent arg0) { checkAttributeSerializable(arg0); } public void attributeRemoved(HttpSessionBindingEvent arg0) { } public void attributeReplaced(HttpSessionBindingEvent arg0) { checkAttributeSerializable(arg0); } private void checkAttributeSerializable(HttpSessionBindingEvent arg0) { ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(new ByteArrayOutputStream(512)); oos.writeObject(arg0.getValue()); } catch (IOException e) { System.out.println(">>> Not serializable session object: " + arg0.getName() + " = " + arg0.getValue()); e.printStackTrace(System.out); } finally { try { oos.close(); } catch (Exception ce) { } } } }
        Hide
        Randy Watler added a comment -

        Resolved this and other related bugs that occurred on server kill. Fixed serialization of ProfilerContext, ensured guest principal name configuration accessed and cached before server shutdown/kill, and prevented transaction proxy and access to stopped PAM component.

        Committed SVN revision: 774210

        Show
        Randy Watler added a comment - Resolved this and other related bugs that occurred on server kill. Fixed serialization of ProfilerContext, ensured guest principal name configuration accessed and cached before server shutdown/kill, and prevented transaction proxy and access to stopped PAM component. Committed SVN revision: 774210
        Hide
        Woonsan Ko added a comment -

        Confirmed it fixed. Thanks, Randy!

        Show
        Woonsan Ko added a comment - Confirmed it fixed. Thanks, Randy!

          People

          • Assignee:
            Randy Watler
            Reporter:
            Woonsan Ko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development