Andrey Myatlyuk wrote:

> [...]
> I have my StatesBean loaded by SystemClassLoader. OK.
> MyServlet by WebAppLoader. Good.
>
> So when WebAppLoader reloads my servlet it should ask its parents
> about loaded class. Ang guess what? StatesBean loaded already with
> SystemClassLoader. What's wrong with it?
>
> Why do I get java.lang.NullPointerException in
> _statesBean=
>       getServletContext().getAttribute(StatesBean.STATES_BEAN_NAME);
>
> after reloading servlets?
>
> --
> Best regards,
>  Andrey                            mailto:[EMAIL PROTECTED]

Hi :-)

*  is the following right?
   - StatesBean is your Helper class
   - STATES_BEAN_NAME is a "public static String" object in StatesBean

if(the above is not right)  return;   //haha  ^_^


*  is StatesBean.STATES_BEAN_NAME.hashCode()  the same one
    before/after MyServlet reloading?

* and I suggest you try the following:
   don't use StatesBean.STATES_BEAN_NAME as the "name" when you
   setAttribute(...):  i.e. I suggest you try:
    - before reloading:
      getServletContext().setAttribute( "haha", new StatesBean() );
    - after reloading:
      Object o = getServletContext().getAttribute( "haha");
      try{
         if(o!=null) StatesBean sb=(StatesBean)o;
      }catch(Exception e){System.out.println(e);}

*  can you post the code of your StatesBean?  and
    the version of TOMCAT? because I also want to
    know why :-)

Bo
Mar.15, 2001


Reply via email to