users@glassfish.java.net

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

From: <Jan.Luehe_at_Sun.COM>
Date: Fri, 25 May 2007 16:20:51 -0700

Jan.Luehe_at_Sun.COM wrote:

> 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)


Fixed.

In order to use file-based persistence, it is now sufficient to specify
"persistence-type" equal to "file" (in sun-web.xml), and mark the app as
distributable (in web.xml).


Jan