users@glassfish.java.net

Re: How to turn off session attribute serialization?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 06 Oct 2008 11:01:23 -0700

On 10/ 1/08 04:40 AM, glassfish_at_javadesktop.org wrote:
> Thanks for the information guys. I'm definitely not restarting the server between deployments or using the 'keepSession' property. I'm using the built-in 'directory deployment' functionality of NetBeans which updates only the files that have changed and then invokes the browser passing a specified url to run the application. This seems to be a very fast way to develop and test so I'm not complaining from that standpoint, its just that it would be nice to not see the Exceptions rolling past on the monitor every time I redeploy. I've tested both closing the browser and leaving the browser open between re-deployments and I get the session persistence Exceptions either way. Here's one example:
>
> PWC2785: Cannot serialize session attribute majorClassSelection for session 826e5da17c66f0d14eff63ae7b16
> java.io.NotSerializableException: org.json.JSONObject
>
> where I've placed an object into a session attribute named 'majorClassSelection'. I get this Exception (and several more) every time I redeploy.
>

I've taken a closer look at this. During a redeploy, a webapp is first
stopped before it is destroyed. As part of being stopped, any active
sessions are serialized and saved to a file, which is then deleted as
part of the subsequent destroy operation. If a stop is followed by a
destroy, it
does not make any sense to save any sessions, and I am going to file
an enhancement request to have the saving of any active sessions suppressed
in this case. This won't be addressed in GlassFish v2.1, though, only
in GlassFish v3.

For the time being, what you can do is bundle the following
sun-web.xml with your webapp, which sets "sessionFilename"
to the empty string:

<?xml version="1.0" encoding="UTF-8"?>
<sun-web-app>
  <session-config>
    <session-manager>
      <manager-properties>
        <property name="sessionFilename" value="" />
      </manager-properties>
    </session-manager>
  </session-config>
</sun-web-app>


This will suppress serialization and saving of any active sessions
when your webapp is stopped (as part of a redeploy or server restart).

Let me know if this works for you.

Thanks!


Jan

> [Message sent by forum member 'sl5337' (sl5337)]
>
> http://forums.java.net/jive/thread.jspa?messageID=302681
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>