1 Reply Latest reply on May 9, 2006 6:22 AM by Atanas Todorov

    EJB class in SAR not reloaded during redeploy

    Atanas Todorov Newbie

      JBoss 4.0.4 CR 2, EJB3

      An application with multiple .ear files, a common .jar and a .sar file.

      The common.jar contains the component (local) interface of a SLSB. The SLSB impl is in one of the ears. Everything works fine, but the problem appears in the SAR file when the application is redeployed. It works fine in ALL of the ears, which are using this ejb (no matter how many times I redeploy)

      So I found the following: when I deploy the first time after starting JBoss, all ejb clients (both sar and ears) retrieve the ejb object w/o a problem. But when I redeploy, the ejb object retrieved by the JNDI lookup in the SAR file is an instance of the same (the old, first loaded) EJB class. There is no problem when retrievig the EJB from any of the ears, because they receive an instance of a new (obviously reloaded) class, which is an "instanceof" the NEW local interface.

      So I get a ClassCastException, because the EJB interface is reloaded and I am trying to cast the ejb impl which is still "instanceof" the OLD EJB Interface.

      This is probably expected behaviour for a SAR, but it is making troubles in this case. Any ideas how to cope with this? Maybe I need to configure JBoss somehow..?