2 Replies Latest reply on Dec 18, 2002 3:23 PM by kself

    ClassCastException in JBoss 3.0.3 trying to bind remote home

    bclyonlx

      This is really driving me insane - and it looks like many other people have similar problems.

      I created an entity bean and a servlet to use it. The servlet works perfectly, binding the bean home through java:enc/ejb and then creating, using, and deleting the beans.

      When I try to bind the same bean home from an application, no matter what I do I get:

      [java] java.lang.Class CastException
      [java] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
      [java] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
      [java] at com.xerox.SIToolkitDomain.samples.DynamicService.DynamicPersistentService.initialize(DynamicPersistentService.java:284)
      [java] at com.xerox.SIToolkitDomain.samples.DynamicService.DynamicPersistentService.setup(DynamicPersistentService.java:204)
      [java] at com.xerox.SIToolkitDomain.samples.DynamicService.StartListener$1.run(StartListener.java:41)
      [java] at java.lang.Thread.run(Thread.java:536)

      This happens whether I have the a jboss.xml that gives the beans explicit names, or if I have no jboss.xml and accept the default jndi names. I can get the naming context and use it to list the binding of the home (which is always bound to a $Proxy - e.g.:

      [java] [DynamicPersistentService]: Name PersistentQueueEntryRecordHome bound to class $Proxy48

      This code worked perfectly in JBoss 2.4.4. What has gone wrong?

      Please help, I have looked through 100's of messages on the forums and looked through the documentation for hours.

      Bruce Lyon

        • 1. Re: ClassCastException in JBoss 3.0.3 trying to bind remote
          bclyonlx

          OK, I finally figured out what I was doing wrong.

          My application was being run from an ant script that was using the client jar files from JBoss 2.4.4.

          When I fixed the ant script to use the JBoss 3.0.3 jars, suddenly everything was cool.

          This may be happening to lots of folks out there - so it is a good thing to check for if you get the ClassCastException from the PortableRemoteObject

          Bruce Lyon

          • 2. Re: ClassCastException in JBoss 3.0.3 trying to bind remote
            kself

            I have a variation on this. I get ClassCastException errors during the home interface casting, (using narrow or not) when I am accessing an EJB from inside another EJB. Strangely, the EJB can be reached with no problem from a client. What makes it even stranger is that the problem is intermittent. Each time I restart the App Server, different EJB's are no longer accessible, and ones that were giving me errors can now be reached and accessed. The code worked fine with JBoss 2.4.4. I have looked everywhere on this machine to find any remnants of the 2.4.4 client libraries and can find none. Any suggestions? I am using JBoss 3.0.2.