1 Reply Latest reply on Jun 9, 2017 4:19 AM by ion_mayank

    Local EJB lookup in Wildfly10.1 throwing ClassCastException for proxy view

    ion_mayank

      My EJB is deploying correctly and binding to JNDI names as per the EJB specs.

       

      When I try to access the EJB local Interface using the following JNDI name pattern:

      java:app/myEJBJar/ActualEJBClass!com.company.ejb.ActaulEJBClassLocal, I get an proxy view of this interface. But when i try to cast it to ActualEJBClassLocal I am getting ClassCastException.

       

      I must tell you I am able to access the bean using Client JNDI with ejb:applicationEAR/myEJBJar/ActualEJBClass!com.company.ejb.ActaulEJBClassLocal.

       

      Please let me know what I need to do so that I can use local JNDI lookup on Wildfly, I am not in favour of using Client JNDI (ejb:...) for local lookups as it is meant for accessing EJBs remotely.

        • 1. Re: Local EJB lookup in Wildfly10.1 throwing ClassCastException for proxy view
          ion_mayank

          After searching web and looking into Wildfly community class loading document I found that WildFly gets Confused if we bundle EJB view interfaces in EAR/lib separately along with EJB jar files. SO basically our application had Interfaces for EJB beans in each EJB jar file and also all interfaces were put in separate jar file within ear/lib directory so that they can be accessed by Servlets or JSF components to call EJB bean methods. But this resulted in ClassCast Exception in Wildfly10.1. Such a setup was working perfectly in Jboss-4.2.2, Jboss-6.0.0.Final but not with WildFly10.

          Hope it helps other who face similar problem in migration.

          Thanks