5 Replies Latest reply on Apr 24, 2005 10:24 AM by Ramesh Polisetty

    NotSerializableException on undeploy of .ear file

    nic7834 Newbie

      Hi all

      Using JBoss 3.2.2 with Tomcat 4.1.27

      My application includes EJBs and a web app front end built upon Struts framework. In the http session I store a collection (java.util.map) of my own data object called 'EventDO'.

      I deploy my .ear and everything works. I then undeploy the .ear by deleting the file. The console output indicates that JBoss is destroying the web app. At this point I get the NotSerializableException for a field in EventDO.

      Thing is I don't care to have this collection serialized as it is repopulated where required. I thought I had this covered by my WebSessionListener class:

      public class WebSessionListener extends HttpServlet implements HttpSessionListener, HttpSessionBindingListener, HttpSessionActivationListener;

      where I empty the collection in question and then set it to null. I have tried this in the valueUnbound(HttpSessionBindingEvent event) and the sessionWillPassivate(HttpSessionEvent httpSessionEvent) methods. Console output indicates these methods aren't called as I see no debug statements.

      Can someone explain why this doesn't work. I am able to get rid of the exception by having EventDO implement the Serializable interface but thats not the behavior I want.

      My web.xml file has the listener set up:

      <web-app>

      <listener-class>com.cci.web.WebSessionListener</listener-class>

      ...
      </web-app>

      The exception trace is this:


      2004-02-06 16:31:43,035 INFO [org.jboss.web.tomcat.tc4.EmbeddedTomcatService] undeploy, ctxPath=/WabiServer, warUrl=file:/D:/Development/jboss-3.2.2_tomcat-4.1.27/server/default/tmp/deploy/tmp1758Server.ear-contents/WabiServer.war/
      2004-02-06 16:31:43,035 INFO [org.jboss.web.localhost.Engine] StandardHost[localhost]: Removing web application at context path /WabiServer
      2004-02-06 16:31:43,055 INFO [org.jboss.web.tomcat.tc4.EmbeddedTomcatService] undeploy, ctxPath=/WebServer, warUrl=file:/D:/Development/jboss-3.2.2_tomcat-4.1.27/server/default/tmp/deploy/tmp1758Server.ear-contents/WebServer.war/
      2004-02-06 16:31:43,055 INFO [org.jboss.web.localhost.Engine] StandardHost[localhost]: Removing web application at context path /WebServer
      2004-02-06 16:31:43,095 ERROR [org.jboss.web.localhost.Engine] StandardManager[/WebServer] Cannot serialize session attribute ID_EVENT for session 79F838E53D82974BA6304FE89E8C5487
      java.io.NotSerializableException: java.util.PropertyResourceBundle
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1439)
      at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:881)
      at org.apache.catalina.session.StandardManager.unload(StandardManager.java:536)
      at org.apache.catalina.session.StandardManager.stop(StandardManager.java:691)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3669)
      at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1036)
      at org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDeployer.java:470)
      at org.apache.catalina.core.StandardHost.remove(StandardHost.java:852)
      at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.performUndeploy(EmbeddedTomcatService.java:348)
      at org.jboss.web.AbstractWebContainer.stop(AbstractWebContainer.java:476)
      at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:489)
      at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:504)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:472)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:467)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:440)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.undeploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.undeploy(URLDeploymentScanner.java:332)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:418)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)
      2004-02-06 16:31:43,105 ERROR [org.jboss.web.localhost.Engine] StandardManager[/WebServer] Cannot serialize session attribute ID_COLLECTION_EVENTS for session 79F838E53D82974BA6304FE89E8C5487
      java.io.NotSerializableException: java.util.PropertyResourceBundle
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at java.util.ArrayList.writeObject(ArrayList.java:529)
      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:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1439)
      at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:881)
      at org.apache.catalina.session.StandardManager.unload(StandardManager.java:536)
      at org.apache.catalina.session.StandardManager.stop(StandardManager.java:691)
      at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3669)
      at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1036)
      at org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDeployer.java:470)
      at org.apache.catalina.core.StandardHost.remove(StandardHost.java:852)
      at org.jboss.web.tomcat.tc4.EmbeddedTomcatService.performUndeploy(EmbeddedTomcatService.java:348)
      at org.jboss.web.AbstractWebContainer.stop(AbstractWebContainer.java:476)
      at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:489)
      at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:504)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:472)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:467)
      at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:440)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.undeploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.undeploy(URLDeploymentScanner.java:332)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:418)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:212)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:191)