2 Replies Latest reply on Feb 10, 2003 4:24 PM by raznor

    ClassCastException on EJB reference

    raznor

      Hi,

      I have a strange problem with getting a reference to an entity bean.

      I try to get an entity bean from a session bean with code like this:

      Object o = (new InitialContext()).lookup("java:comp/env/ProjectEJB");
      return (LocalProjectHome)o;

      I get a ClassCastException at the return statement. I tried to get information about the class and it is called $Proxy40 and it implements the interface LocalProjectHome (thats what o.getClass().getInterfaces() tells me).

      Any idea what the problem could be?

        • 1. Re: ClassCastException on EJB reference
          raja05

          Do you hvae another class called LocalProjectHome in your deploy directory(in another jar file)? JBoss uses the Unified Class Repository so i think there is one repository which would store all classes from all the ejb-jars. There is a way to overcome this by using one of the jboss-*.xml files.

          -Raj

          • 2. Re: ClassCastException on EJB reference
            raznor

            Yes that is the problem. I did a search for this class and found some copies of the JAR in the tmp tree. Seems they didn't get deleted correctly. Maybe an unclean shutdown.

            Thanks.