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

So, my question now becomes, when in development mode using the
source-reload feature of Orion, does Orion "kill" any HttpSession objects?
Even so, this code should just recreate the bean and store it in the
session. The line that causes the exception is htmlBean =
(com.bm.ui.beans.HtmlBean) application.getAttribute("htmlBean");

One thought comes to mind..can you typecast a null into an object? If the
application.getAttribute("htmlBean") returns null, does that cause the
problem..that its being typecasted to com.bm.ui.beans.HtmlBean)? If so, it
would seem the code should read:  if( application.getAttribute("htmlBean")
== null ) { ..create bean and store it..} else htmlBean =
(com.bm.ui.beans.HtmlBean) application.getAttribute("htmlBean");

Thanks for any help.


Reply via email to