Skip to main content

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

10 replies [Last post]
hazurek
Offline
Joined: 2006-08-03

Is this feature working in glassfish V2?

I try to use it in my web-app, here is my sun-web.xml:

/KE

But nothing happens. Directory domain1/session-store is empty. There is no error messages in server.log.

What could be wrong?
Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jan.Luehe@Sun.COM

glassfish@javadesktop.org wrote:

>Yes, the problem was with class serialization and we've solve it.
>
>

Great!

>So as I understand starting from build 49 there is no need to set availability-enabled="true" for application:
>
>?
>Is it done out of box now?
>
>

In order to use file persistence, you no longer need to set
availability-enabled="true"
for your webapp.

This setting continues to be required for all other session persistence
types, though.

Jan

>And one more usability issue. When application is redeployed "availability-enabled" application parameter is always set to "false". This is very uncomfortable to set it by hand every time after redeploy. Is this also fixed by https://glassfish.dev.java.net/issues/show_bug.cgi?id=3066 ?
>
>Thank you.
>[Message sent by forum member 'hazurek' (hazurek)]
>
>http://forums.java.net/jive/thread.jspa?messageID=220795
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Dick Davies

On 06/06/07, glassfish@javadesktop.org wrote:

> And one more usability issue. When application is redeployed "availability-enabled" application parameter is always set to "false". This is very uncomfortable to set it by hand

The 'asadmin deploy' command has an '--availabilityenabled' flag you
can set to true.
Would that do what you want?

--
Rasputin :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Jan.Luehe@Sun.COM

glassfish@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:
>
>
> /KE
>
>
>
>
>

>
>
>
>

>

>

>
>

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



This element must be added right between

and

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 ) and "web-container" (from
) 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 element
identifies the directory in which your sessions will be persisted. The
default
file name of a persisted session is ".session", where 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:

/generated/jsp/j2ee-modules//

where is the value of the "directory" property.

Hope this helps.

Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Jan.Luehe@Sun.COM

Jan.Luehe@Sun.COM wrote:

> glassfish@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:
>>
>>
>> /KE
>>
>>
>>
>>
>> value="web-method"/>
>>

>>
>>
>>
>>

>>

>>

>>
>>

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

>
> This element must be added right between
>
>
>
> and
>
>
>
> 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 ) and "web-container" (from
> ) 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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

hazurek
Offline
Joined: 2006-08-03

First of all, thank you for your answer.
I added those lines into domain.xml but one more thing I needed to do is to change
availability-enabled to true in:

So then I saw in log that file-based persistence is enabled for my application.
I tried to work with application, then restart domain and try to continue my session.
But exception was thrown:

[#|2007-05-28T10:33:57.703+0400|SEVERE|sun-appserver9.1|org.apache.catalina.core
.ContainerBase|_ThreadID=13;_ThreadName=ContainerBackgroundProcessor[StandardEng
ine[com.sun.appserv].StandardHost[server].StandardContext[/KE]];_RequestID=36657
087-c514-4055-ba5a-0fa60fa18977;|Exception invoking periodic operation:
java.lang.ClassCastException: cannot assign instance of java.lang.String to fiel
d com.sitronicsts.ngage.ke.ui.managed.SessionContext.facade of type com.sitronic
sts.ngage.ke.datalayer.core.KESessionFacade in instance of com.sitronicsts.ngage
.ke.ui.managed.SessionContext
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStre
amClass.java:2004)

What could be the problem?

Jan.Luehe@Sun.COM

glassfish@javadesktop.org wrote:

>First of all, thank you for your answer.
>I added those lines into domain.xml but one more thing I needed to do is to change
>availability-enabled to true in:
>
>
>
>

Yes, that's right.

You can achieve the same by passing

--availabilityenabled=true

to the "asadmin deploy" command.

As I mentioned earlier, the fix for

https://glassfish.dev.java.net/issues/show_bug.cgi?id=3066

which will be available as of 9.1 b49, eliminates the need for enabling
availability at the various levels when using file persistence.

>So then I saw in log that file-based persistence is enabled for my application.
>I tried to work with application, then restart domain and try to continue my session.
>But exception was thrown:
>
>[#|2007-05-28T10:33:57.703+0400|SEVERE|sun-appserver9.1|org.apache.catalina.core
>.ContainerBase|_ThreadID=13;_ThreadName=ContainerBackgroundProcessor[StandardEng
>ine[com.sun.appserv].StandardHost[server].StandardContext[/KE]];_RequestID=36657
>087-c514-4055-ba5a-0fa60fa18977;|Exception invoking periodic operation:
>java.lang.ClassCastException: cannot assign instance of java.lang.String to fiel
>d com.sitronicsts.ngage.ke.ui.managed.SessionContext.facade of type com.sitronic
>sts.ngage.ke.datalayer.core.KESessionFacade in instance of com.sitronicsts.ngage
>.ke.ui.managed.SessionContext
> at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStre
>amClass.java:2004)
>
>What could be the problem?
>
>

File persistence leverages standard Java serialization and deserialization
techniques for session data.

I assume com.sitronicsts.ngage.ke.ui.managed.SessionContext is stored
as a session attribute?

Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

hazurek
Offline
Joined: 2006-08-03

Yes, the problem was with class serialization and we've solve it.

So as I understand starting from build 49 there is no need to set availability-enabled="true" for application:

?
Is it done out of box now?

And one more usability issue. When application is redeployed "availability-enabled" application parameter is always set to "false". This is very uncomfortable to set it by hand every time after redeploy. Is this also fixed by https://glassfish.dev.java.net/issues/show_bug.cgi?id=3066 ?

Thank you.

Hong Zhang

>And one more usability issue. When application is redeployed "availability-enabled" application parameter is always set to "false". This is very uncomfortable to set it by hand every time after redeploy. Is this also fixed by https://glassfish.dev.java.net/issues/show_bug.cgi?id=3066 ?
>
>
How did you redeploy the app?

Normally if you don't explicitly specify the "availability-enabled"
attribute during redeployment, the redeployment would take the default
value of "availability-enabled" which is false.

However, I noticed if redeploying through admin console, there is no
place to update attribute values. So it might make sense for the admin
console to remember the old attribute values and pass them in during
redeployment so the attribute values are retained during redeployment.
This will be the more user friendly behavior.

Thanks,

- Hong

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

hazurek
Offline
Joined: 2006-08-03

We are using autodeploy feature, so every time application is autoredeployed this setting is set to "false".

Hong Zhang

I see. For auto redeploy case, user doesn't have the opportunity to
specify attributes either. So it also makes sense to retain the
attribute values during redeployment.
I have filed a glassfish enhancement for this:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=3145

Thanks for reporting this.

- Hong

>We are using autodeploy feature, so every time application is autoredeployed this setting is set to "false".
>[Message sent by forum member 'hazurek' (hazurek)]
>
>http://forums.java.net/jive/thread.jspa?messageID=220918
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
>For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net