Skip to main content

Question about "persistence" - Web Apps

4 replies [Last post]
bryanut
Offline
Joined: 2008-01-11

We have an application that consists of a remote stateless session bean (EJB) and several JSF (Visual Web App) pages. There is also a managed session backing bean. The application is running on Glassfish V2.

We are seeing this error in our logs:

[#|2009-06-25T14:08:15.448-0600|SEVERE|sun-appserver9.1|org.apache.catalina.session.ManagerBase|_ThreadID=22;_ThreadName=pool-1-thread-20;_RequestID
=3f8f4d90-f1fc-4716-9633-85d966f219e3;|PWC2773: Exception loading sessions from persistent storage
java.lang.ClassCastException: cannot assign instance of java.lang.String to field edu.utah.acs.student.finaidawardletterejb.AwardLetter.selectedLend
er of type edu.utah.acs.student.finaidawardletterejb.Lender in instance of edu.utah.acs.student.finaidawardletterejb.AwardLetter
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2004)

The "AwardLetter" is an object held in the managed session backing bean.

I just don't understand why this object would be persisted. Can someone explain what is going on or point me to a link that describes the behavior?

Thanks,

Bryan

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Martin Gainty

the class edu.utah.acs.student.finaidawardletterejb.AwardLetter.selectedLender
needs to implement Serializable
You also need a private static final long serialVersionUID = [someuniquevalue];

Viel Gluck,
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

> Date: Sun, 28 Jun 2009 09:28:56 -0700
> From: glassfish@javadesktop.org
> To: users@glassfish.dev.java.net
> Subject: Question about "persistence" - Web Apps
>
> We have an application that consists of a remote stateless session bean (EJB) and several JSF (Visual Web App) pages. There is also a managed session backing bean. The application is running on Glassfish V2.
>
> We are seeing this error in our logs:
>
> [#|2009-06-25T14:08:15.448-0600|SEVERE|sun-appserver9.1|org.apache.catalina.session.ManagerBase|_ThreadID=22;_ThreadName=pool-1-thread-20;_RequestID
> =3f8f4d90-f1fc-4716-9633-85d966f219e3;|PWC2773: Exception loading sessions from persistent storage
> java.lang.ClassCastException: cannot assign instance of java.lang.String to field edu.utah.acs.student.finaidawardletterejb.AwardLetter.selectedLend
> er of type edu.utah.acs.student.finaidawardletterejb.Lender in instance of edu.utah.acs.student.finaidawardletterejb.AwardLetter
> at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2004)
>
> The "AwardLetter" is an object held in the managed session backing bean.
>
> I just don't understand why this object would be persisted. Can someone explain what is going on or point me to a link that describes the behavior?
>
> Thanks,
>
> Bryan
> [Message sent by forum member 'bryanut' (bryanut)]
>
> http://forums.java.net/jive/thread.jspa?messageID=353318
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tut...
[att1.html]

bryanut
Offline
Joined: 2008-01-11

Yes, we did precisely that.

But the developers are running around asking "why?" For some reason they think that glassfish shouldn't be persisting their object and they want the systems admins to "fix it" via some sort of configuration setting.

I read on some blog that glassfish persists all sessions whenever an "asadmin stop-domain foo" is executed. It writes all objects to ".ser" files that are deleted upon restart. This may explain why stop-domain is so slow. Why does it do this?

Does this mean that a browser may not even notice a stop-domain / start-domain cycle?

I did see there is a setting in sun-web.xml that prevent this on individual applications.

Martin Gainty

to conform with the spec on persisting entity beans
http://java.sun.com/developer/technicalArticles/J2EE/jpa/

you can disable persistence by declaring your attribute as @Transient or the more egregious 'static'

Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

> Date: Sun, 28 Jun 2009 12:22:18 -0700
> From: glassfish@javadesktop.org
> To: users@glassfish.dev.java.net
> Subject: Re: RE: Question about "persistence" - Web Apps
>
> Yes, we did precisely that.
>
> But the developers are running around asking "why?" For some reason they think that glassfish shouldn't be persisting their object and they want the systems admins to "fix it" via some sort of configuration setting.
>
> I read on some blog that glassfish persists all sessions whenever an "asadmin stop-domain foo" is executed. It writes all objects to ".ser" files that are deleted upon restart. This may explain why stop-domain is so slow. Why does it do this?
>
> Does this mean that a browser may not even notice a stop-domain / start-domain cycle?
>
> I did see there is a setting in sun-web.xml that prevent this on individual applications.
> [Message sent by forum member 'bryanut' (bryanut)]
>
> http://forums.java.net/jive/thread.jspa?messageID=353323
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tu...
[att1.html]

Marina Vatkina

Martin,

This is session persistence, not JPA (it *is* confusing).

Regards,
-marina

Martin Gainty wrote:
> to conform with the spec on persisting entity beans
> http://java.sun.com/developer/technicalArticles/J2EE/jpa/
>
> you can disable persistence by declaring your attribute as @Transient or
> the more egregious 'static'
>
> Martin Gainty
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
> Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük,
> hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
> készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
> semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
> könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
> ezen üzenet tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
> Diese Nachricht dient lediglich dem Austausch von Informationen und
> entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
> Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt
> uebernehmen.
>
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>
>
>
>
> > Date: Sun, 28 Jun 2009 12:22:18 -0700
> > From: glassfish@javadesktop.org
> > To: users@glassfish.dev.java.net
> > Subject: Re: RE: Question about "persistence" - Web Apps
> >
> > Yes, we did precisely that.
> >
> > But the developers are running around asking "why?" For some reason
> they think that glassfish shouldn't be persisting their object and they
> want the systems admins to "fix it" via some sort of configuration setting.
> >
> > I read on some blog that glassfish persists all sessions whenever an
> "asadmin stop-domain foo" is executed. It writes all objects to ".ser"
> files that are deleted upon restart. This may explain why stop-domain is
> so slow. Why does it do this?
> >
> > Does this mean that a browser may not even notice a stop-domain /
> start-domain cycle?
> >
> > I did see there is a setting in sun-web.xml that prevent this on
> individual applications.
> > [Message sent by forum member 'bryanut' (bryanut)]
> >
> > http://forums.java.net/jive/thread.jspa?messageID=353323
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> > For additional commands, e-mail: users-help@glassfish.dev.java.net
> >
>
> ------------------------------------------------------------------------
> Insert movie times and more without leaving Hotmail®. See how.
>

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