0 Replies Latest reply on Apr 23, 2015 2:54 PM by smasilamani

    Jboss EAP 6.2 ClassCastException When looking up EJB

    smasilamani

      Hi

       

      We have two EAR applications and we are trying to look up an EJB resides on EAR1 from EAR2 application and getting ClassCastException for the Same class.

       

      E.g.

       

      EAR1:

           EJB1.jar

           WAR1.war

       

      EAR2:

           EJB2.jar

           WAR2.jar

       

      One of the classes from EJB2.jar is trying to look up an EJB from EAR1.EJB1.jar and I can see that EJB look up is working fine but when we call one of the methods on EAR1.EJB1 ,we are getting ClassNotFoundException for one of the utility classes from EJB1.jar (BranchSummarry.java)

       

      This is what I have tried with no luck:

      1. Created a module for EAR1.EJB1.jar inside module folder and add it as a dependancy in Jboss-deployment-structure.xml

      2.Added the EJB1.jar to the lib dir of EAR2

       

      Another interesting thing in jboss-deployment-structure.xml of EAR2, is that unless I add export =true,I am getting ClassNotFoundExcetion for  BranchSummary.java from EJB2 module,I do not understand why export=true works but throwing ClassCastException.

       

      As a last try,I enabled jvm version to class and see which classloaded is loading the classes from EJB1.jar and found that only two loader do that,one class loaded for EAR1.jar and another is from module that I created.

       

      Your help is much appreciated.