1 Reply Latest reply on Aug 27, 2004 4:46 PM by astehman

    ClassCastException on Session Bean - Classloader issue?

    astehman Newbie

      jboss/linux versions: Jboss 3.2.1 on Mandrake linux 2.4.21-199-default

      I'd be grateful if anyone can give me any clues what to check. When a Struts Action class attempts to lookup a Session bean, it gets a ClassCastException. I don't understand how - jboss.jar and ejb-jar.xml look good, and the code looks fine. Is it because the class trying to load the SSB lives in WEB-INF, and the class it is trying to load lives in the app jar?

      The problematic line of code (where userInterfaceQE is of type UserInterfaceQE):

      userInterfaceQE = (UserInterfaceQE) ((UserInterfaceQEHome) EJBHomeFactory.getFactory().lookUpHome(UserInterfaceQEHome.class)).create();

      --------------------------------------------------------------------
      The ejb-jar entry:
      --------------------------------------------------------------------

      <ejb-name>UserInterfaceQE</ejb-name>
      com.cadmus.rpm.session.ui.UserInterfaceQE.UserInterfaceQEHome
      com.cadmus.rpm.session.ui.UserInterfaceQE.UserInterfaceQE
      <local-home>com.cadmus.rpm.session.ui.UserInterfaceQE.UserInterfaceQELocalHome</local-home>
      com.cadmus.rpm.session.ui.UserInterfaceQE.UserInterfaceQELocal
      <ejb-class>com.cadmus.rpm.session.ui.UserInterfaceQE.UserInterfaceQEBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      --------------------------------------------------------------------
      The jboss.xml entry:
      --------------------------------------------------------------------

      <ejb-name>UserInterfaceQE</ejb-name>
      <jndi-name>com/cadmus/rpm/session/ui/UserInterfaceQE/UserInterfaceQE</jndi-name>
      <local-jndi-name>com/cadmus/rpm/session/ui/UserInterfaceQE/UserInterfaceQELocal</local-jndi-name>


      --------------------------------------------------------------------
      Locations of the Action class vs. Session class
      --------------------------------------------------------------------
      Session lives in app jar:

      ./deploy/rpm_application.ear/rpm_server.jar/com/cadmus/rpm/session/ui/UserInterfaceQE/UserInterfaceQE.class

      Action lives in WEB-INF:
      ./deploy/rpm_application.ear/rpm.war/WEB-INF/classes/com/cadmus/rpm/ui/editorial/EditorialPoolAction.class