4 Replies Latest reply on Aug 6, 2015 3:28 AM by jagadish1221

    Getting javax.naming.NameNotFoundException with wildfly server

    jagadish1221

      Hi all,

      Please help me on the below issue.

      We are migrating to WildFly8.1.0.final from Jboss6.

      We deployed the code successfully and able to see the login page.

      When we trying to login we are getting the below exception.

      16:52:57,113 ERROR [stderr] (default task-5) javax.naming.NameNotFoundException: CrdsEjbController -- service jboss.naming.context.java.CrdsEjbController

      16:52:57,114 ERROR [stderr] (default task-5)  at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)

       

       

      Thanks,

        • 1. Re: Getting javax.naming.NameNotFoundException with wildfly server
          jaysensharma

          The above Error indicates that you are passing an incorrect JNDI name to the lookup method  while trying to lookup.

          Check your log to see find your EJB is deployed with exactly which JNDI names.  As you are migrating from JBoss AS6 to WildFly hence it is quite possible that your code might be trying to use the non EE6  Portable JNDI naming, Which might be leading to this issue.

           

          Check the following link to know more about Portable JNDI Syntax: JNDI Reference - WildFly 8 - Project Documentation Editor  to know more about "java:global", "java:app" and "java:module"


          Try with the following JNDI format for testing (OR check your log to find the JNDI name listed there for the Bean CrdsEjbController):

          java:global[/application name]/module name/enterprise bean name[/interface name]

          • 2. Re: Getting javax.naming.NameNotFoundException with wildfly server
            jaysensharma

            Hello Jagadish,

             

               You can try the java:global, java:app, java:module naming prefix for your EJB JNDI lookup based on Where the EJB is actually deployes as part of the same Module/Same App or deployed in the same server as the EJB Client you can choose the suitable JNDI name.   However "java:global" prefixed name should work fine in any case where the EJB Bean and the Client is deployed on the same server. So please try the following:

             

             

                        ctx = new InitialContext();

                        String CRDS_EJB_CONTROLLER = "java:global/DiscoEAR/discoEjb/CrdsEjbController!com.boeing.crds.arch.control.ejb.CrdsEjbControllerHome";

                        home = (CrdsEjbControllerHome) ctx.lookup(CRDS_EJB_CONTROLLER);

            • 3. Re: Getting javax.naming.NameNotFoundException with wildfly server
              jagadish1221

              Thanks Jay

              • 4. Re: Getting javax.naming.NameNotFoundException with wildfly server
                jagadish1221

                Hi Jay,

                 

                Is there any way where we can declare JNDI names globally as below ?

                java:global [/application name]/module name/enterprise bean name[/interface name]

                 

                Because I have to modify in many places  in the same manner for each ejb.

                 

                Thanks,

                Jagadish