0 Replies Latest reply on Sep 12, 2018 10:50 AM by Narmada Lavu

    Wildfly 13 and EJB 2.1 compatibility issue and RelativeContext Classcast issue

    Narmada Lavu Newbie

      Can anyone help to solve the below issue:



      I am trying to upgrade my application server from JBOSS 6 to Wildfly 12/13. My Application is EJB based. When i am using Jboss 6, I used Jdk 1.7 Now for Wildfly, i am using jdk 1.8.

      And, while upgrading to Wildfly, previous jndi settings also not working so i updated jndi configurations from

      configurations file:

      INITIAL_CONTEXT_FACTORY = org.jnp.interfaces.NamingContextFactory

      PROVIDER_URL = jnp://localhost:1099

      URL_PKG_PREFIXES = org.jboss.naming:org.jnp.interfaces




      configurations file:

      INITIAL_CONTEXT_FACTORY = org.wildfly.naming.client.WildFlyInitialContextFactory

      PROVIDER_URL = remote+http://localhost:8080

      URL_PKG_PREFIXES = org.jboss.ejb.client.naming



      Now i am getting error as: ERROR [com.aithent.voor.service.ServiceLocator] (ServerService Thread Pool -- 79) Exception whichle retrieving the home object for the EJB : UserServiceEJB ERROR [com.aithent.voor.service.ServiceLocator] (ServerService Thread Pool -- 79) org.wildfly.naming.client.store.RelativeContext cannot be cast to javax.ejb.EJBHome ERROR [com.aithent.voor.service.ServiceFactory] (ServerService Thread Pool -- 79) java.lang.ClassCastException: org.wildfly.naming.client.store.RelativeContext cannot be cast to javax.ejb.EJBHome


      ServiceLocator class:


      public EJBHome getHome(String ejbName) throws Exception{

          EJBHome ejbHome = null;

          log.debug("ServiceLocator getHome() starts ");


              System.out.println("Context: "+context);

              if(context != null){


                  Object home = context.lookup("ejb:/"+ejbName); //here i am getting the issue because object is returning RelativeContext instance.


                  ejbHome = (EJBHome) home;



          }catch(Exception e){

              log.error("Exception whichle retrieving the home object for the EJB : " + ejbName);


              throw new Exception(e);


          log.debug("ServiceLocator getHome() ends ");

          return ejbHome;


      I even added jboss-client from wildfly-13 - bin/client folder. I tried almost everyway posted in other Q&A's but nothing worked.

      In other way:

      I tried to convert ejb 2 to ejb 3. but since i have 3 ejb's, i didn't get any example how to convert serviceFactory and ServiceLocator classes code to ejb3.

      I am attaching server.log and standalone-full.xml for review.


      Thanks for help in advance..