Hi Karl,

You brought to my attention two things that I wasn't doing. First, I didn't
realize this..but the HtmlBean was not implementing the Serializable
interface. I added that.

Second, I notice you say to use something called serialVersionUID, what is
that about? I recall one of our engineers say that all classes implementing
serializable needed a specific UID set, but from what I read, that was not
necessary. He also reimplements the serializable interface in every
descendant class and each one sets this variable to some number. Is his way
correct? Also, if so..how do you get the number?

Thanks.


> Kevin Duffey wrote:
>
> > Hi,
> >
> > I am using the development mode (true) and set up the source
> directory to
> > point to my source. When I save a change, and refresh the page,
> I am always
> > getting a Class Cast Exception error. I store a bean called HtmlBean as
> > application scope. In the .java generated, I see that the
> > syncronized(application) {  } code is where the exception is
> occuring. It
> > looks something like this:
> >
> > com.bm.ui.beans.HtmlBean htmlBean;
> > synchronized(application)
> > {
> >   htmlBean =
> (com.bm.ui.beans.HtmlBean)application.getAttribute("htmlBean");
> >   if(htmlBean == null)
> >   {
> >     htmlBean = new com.bm.ui.beans.HtmlBean();
> >     application.setAttribute("htmlBean", htmlBean);
> >   }
> > }
> >
>
> Note that you're storing the bean as an application scope
> variable. This means
> that the bean scope is tied to lifetime of your web-application, not the
> session. In your case, as the class is modified you will still
> have the "old"
> bean stored in the ServletContext and you try to cast it to the
> "new" bean.
> Normally Orion should restart the web-application in such a case
> and serialize
> the application scope contents across the restart (but of course,
> if your bean
> isn't serializable with a serialVersionUID set, the values will
> be lost between
> restarts, as usual).
>
> We will look into if this is due to something wrong in Orion's
> behaviour or if
> it can be something else. Possibly the old application hasn't died and
> serialized the application contents.
>
> Regards,
> Karl Avedal
>
>


Reply via email to