3 Replies Latest reply on Dec 26, 2001 11:56 PM by mesketh

    ClassCastException $Proxy0, suggestions needed



      I am realy puzzled this time, although I am convinced that I am overlooking something trivial. When I started using JBoss I ran into the famous ClassCastException $Proxy..
      Since I solved that I did not have any such trouble again, until....
      Yes, until I installed my JSP application on the production machine, then it showed up again. No matter what I do now, it keeps on throwing the d%^&(@-ed ClassCastException $Proxy0 at me. I digged into the
      code of PortableRemoteObject.narrow(), I found out that
      the exception is thrown at the following line:

      org.omg.CORBA.portable.ObjectImpl narrowObj =
      (org.omg.CORBA.portable.ObjectImpl) narrowFrom;

      Unfortunately that doesn't tell me anything. Anybody who could shed some light on this will earn my eternal gratitude. By the way throwing out the narrow() doesn't do a thing since that also throws a ClassCastException at me.


      Cor Hofman.

        • 1. Re: ClassCastException $Proxy0, suggestions needed

          Hi all,
          The issue I raised seems to be a classloader related problem. I originally packed my EJB interface definitions a .war, which was placed in the WEB-INF/lib directory of JSP platform (ServletExec 4.1). As long as I kept doing this I got the ClassCastException $Proxy0. The exception disapeared when I include the .jar with the EJB interface definitions in the classpath. I also had to include any class definitions that were refered to from the interface definitions. For instance I spec'ed that an interface method throwed a home-made Exception. Now I got a ClassDefNotFoundException until I also included a .jar, containing this Exception, in the classpath.

          So I found a work-around, but I am not happy with it, since I now have to restart the JSP platform every time I update my application. This effectively knocks out my web application for a certain amount of time.
          I always understood that I could package the EJB interface definitions in a .war file, together with all the other application stuff.
          Is there anybody out there who is able to say something sensible about this?



          • 2. Re: ClassCastException $Proxy0, suggestions needed

            I've have nothing to add except that I'm struggling with the same issue. (no joy at present, still trying you solution.) - Does anyone know of an easy(ier) way around this ?


            • 3. Re: ClassCastException $Proxy0, suggestions needed

              The only time I've ever encountered that problem is when I've tried to cast what is the 'remote' impl from say, a finder method to something else which, quite obviously, doesn't extend EJBObject. This probably doesn't help.