2 Replies Latest reply on Jun 30, 2003 11:02 AM by Kelly Dolan

    Urgent! PortableRemoteObject.narrow() throws ClassCastExcept

    Kelly Dolan Newbie

      First, thanks to anyone that can help me out! Next, the problem...

      I have an EAR file that runs under JBoss 2.4.3. I need to upgrade to JBoss to 2.4.4. When I tried deploying the exact same EAR under JBoss 2.4.4, I get a ClassCastException from a call to PortableRemoteObject.narrow(). I have scoured newsgroup postings and have attempted the various things others have tried so I am now at a loss...here's what I know...

      1. In JBoss 2.4.3, the narrow() method returns successfully. In JBoss 2.4.4, the narrow() method returns successfully IF I narrow it to EJBHome but not to my specific class.

      2. Looking at the implementation of the narrow() method, it calls a method obj1.isAssignableFrom(obj2). In JBoss 2.4.3, this method returns true. In JBoss 2.4.4, this method is returning false.

      It seems that the proxy stub that JBoss is generating does not subclass my Home interface properly (???)...I included the structure of my EAR file below. The Home class actually resides in a few locations but I verified that they are in fact identical in case JBoss was loading the class from two different locations.


      myapp.ear
      - myapp.war
      - aclientlib.jar - this jar contains classes required by clients using the ejb
      - Home.class
      - aejb.jar - this jar is the ejb!
      - Home.class
      - aclientlib.jar - this jar contains classes required by clients using the ejb
      - Home.class


      Thanks! Also, is there any place I can read about what has changed from 2.4.3 to 2.4.4, what known bugs exist in 2.4.4, etc.?

      - Kelly

        • 1. Re: Urgent! PortableRemoteObject.narrow() throws ClassCastEx
          Jon Barnett Master

          Back in the 2.4.x days, we only encountered this problem in two instances. One was when we upgraded our JDK and it started producing different UIDs (server and client had different JDKs) - at least that's what I think was the problem as my lab scratchings are now a bit incomprehensible to me now. The second was when we didn't update the clients correctly.

          You may want to check the UIDs on the client and the server - first through serialver with the JDK. The next would be to System.println in-program.

          The reason EJBHome works is because every home class extends it, so you'd hope that narrow works for EJBHome otherwise your problems are bigger than you imagined. ;)

          Check those and we can go from there.

          • 2. Re: Urgent! PortableRemoteObject.narrow() throws ClassCastEx
            Kelly Dolan Newbie

            Thanks. FYI...our client and server workstations are the same machine and we've verified the JARs used by the client are the same as those used by the server. Finally, we tried deploying our EAR file under JBoss 3.something and no longer received the error.