users@glassfish.java.net

Re: Is persistence-type="file" for webapp working?

From: <Jan.Luehe_at_Sun.COM>
Date: Fri, 25 May 2007 12:45:04 -0700

glassfish_at_javadesktop.org wrote:

>Is this feature working in glassfish V2?
>
>I try to use it in my web-app, here is my sun-web.xml:
>
><sun-web-app>
> <context-root>/KE</context-root>
> <session-config>
> <session-manager persistence-type="file">
> <manager-properties>
> <property name="persistenceFrequency" value="web-method"/>
> </manager-properties>
> <store-properties>
> <property name="persistenceScope" value="session"/>
> <property name="directory" value="testsession" />
> </store-properties>
> </session-manager>
> </session-config>
>
></sun-web-app>
>
>
>But nothing happens. Directory domain1/session-store is empty. There is no error messages in server.log.
>
>What could be wrong?
>
>

Unfortunately, "file" persistence type does not work out-of-the-box on
the DAS in any of the [developer,cluster,enterprise] profiles.

To make it work, you need to add this element to the config pertaining
to your DAS:

    <availability-service availability-enabled="true">
        <web-container-availability availability-enabled="true"/>
    </availability-service>

This element must be added right between

  </java-config>

and

  <thread-pools>

Of course, we never recommend to edit the domain.xml, so using the CLI
or admin-gui to add this element might be safer.

Any persistence-type other than "memory" currently requires the
"global" (from <availability-service>) and "web-container" (from
<web-container-availability>) availability flags to be enabled (in
this context, "available" means "highly available", which supports
failover capabilities). "file" persistence type is no exception.

We should lift the "availability" requirement for "file" persistence,
to make "file" persistence easier to use.

I've filed this enhancement:

   https://glassfish.dev.java.net/issues/show_bug.cgi?id=3066
   ("file" persistence for HTTP sessions hard to enable)

Also, in order for "file" persistence to work, your webapp must be marked
as "distributable" in its web.xml.

Lastly, the property with name "directory" of the <store-properties> element
identifies the directory in which your sessions will be persisted. The
default
file name of a persisted session is "<id>.session", where <id> is the
session's
ID.

The value of the "directory" property may be an absolute or relative
path. If a
relative path, it will be resolved against your webapp's "workdir", as
follows:

  <your-domain>/generated/jsp/j2ee-modules/<your-module-name>/<directory>

where <directory> is the value of the "directory" property.

Hope this helps.


Jan