1 Reply Latest reply on Apr 30, 2013 2:49 AM by ANAND KUMAR GEORGE PREM KUMAR

    EJB getting Initial Context Failed

    ANAND KUMAR GEORGE PREM KUMAR Newbie

      Am getting the below mentioned exception stack trace while initialization of the Initial context for the EJB 2.1 in our application. We are using JBOSS EAP 6.0.1.GA

       

      In our application, we use the below piece of code to initialise the JNDI Context. All the initialization parameters are configured in a file named JNDIConfig.xml  under application specific configuration files directory "/export/home/provider/u01/app/mmtxprv_mmx11_dev/config"   This below piece of code pulls the initial context parameters from this file.

       

      JNDIConfig.xml and standalone-full.xml attached with this email for your reference. Kindly advise.

       

      Exception Stack Trace:

       

      11:21:29,582 INFO  [stdout] (MSC service thread 1-7) value of m_nameValuePair[ i ].getValue() here isorg.jboss.naming:org.jnp.interfaces

      11:21:29,586 INFO  [stdout] (MSC service thread 1-7) We were unable to get a connection to the server 'CX'. Please check JNDIConfig.xml and make sure that the server is running.

      11:21:29,586 ERROR [stderr] (MSC service thread 1-7) javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.CMS.ear.MobileMatrixWEB-1.0.0-SNAPSHOT.war:main" from Service Module Loader

      11:21:29,586 ERROR [stderr] (MSC service thread 1-7)    at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at javax.naming.InitialContext.init(InitialContext.java:223)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at javax.naming.InitialContext.<init>(InitialContext.java:197)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.fd.ejb.JNDICache.getInitialContext(JNDICache.java:358)

      11:21:29,587 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.fd.ejb.JNDICache.doLookup(JNDICache.java:286)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.fd.ejb.JNDICache.doGetLocalHome(JNDICache.java:265)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.fd.ejb.JNDICache.getLocalHome(JNDICache.java:87)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.cx.web.RequestManager.checkSchemaVersion(RequestManager.java:907)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at com.cassis.cx.web.RequestManager.init(RequestManager.java:193)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at javax.servlet.GenericServlet.init(GenericServlet.java:242)

      11:21:29,588 ERROR [stderr] (MSC service thread 1-7)    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:89)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

      11:21:29,589 ERROR [stderr] (MSC service thread 1-7)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

      11:21:29,590 ERROR [stderr] (MSC service thread 1-7)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

      11:21:29,590 ERROR [stderr] (MSC service thread 1-7)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

      11:21:29,590 ERROR [stderr] (MSC service thread 1-7)    at java.lang.Thread.run(Thread.java:662)

      11:21:29,714 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers

      11:21:30,523 INFO  [org.jboss.as.connector.deployment] JBAS010410: Unbound JCA ConnectionFactory [java:/JmsXA]

      11:21:30,571 INFO  [org.jboss.as.connector.subsystems.datasources] JBAS010409: Unbound data source [java:jboss/datasources/MM7_SHARED]

      11:21:30,668 INFO  [org.jboss.as.messaging] JBAS011605: Unbound messaging object to jndi name java:/queue/PINotificationQueue

      11:21:30,681 INFO  [jacorb.poa] POA Naming destroyed

      11:21:30,681 INFO  [jacorb.poa] POA IRPOA destroyed

      11:21:30,682 INFO  [jacorb.orb] prepare ORB for shutdown...

      11:21:30,682 INFO  [jacorb.poa] POA RootPOA destroyed

      11:21:30,682 INFO  [jacorb.orb] ORB going down...

      11:21:30,690 INFO  [org.hornetq.ra.HornetQResourceAdapter] HornetQ resource adapter stopped

      11:21:30,694 INFO  [jacorb.orb] ORB shutdown complete

      11:21:30,694 INFO  [jacorb.orb] ORB run, exit

      11:21:30,696 INFO  [jacorb.orb.iiop] Listener exited

       

       

       

      Code Snippets:

       

      private InitialContext getInitialContext(String name)

                  throws NamingException {

              InitialContext context = (InitialContext) m_contexts.get(name);

              if (context != null) {

                  return context;

              }

              try {

                  for (int i = 0; i < m_config.m_initialContext.length; i++) {

                      System.out.println("value of name in jndi cache is" + name);

                      System.out

                              .println("value of m_config.m_initialContext[ i ].getName() in jndi cache is"

                                      + m_config.m_initialContext[i].getName());

       

                      System.out

                              .println("value of m_config.m_initialContext[ i ].toProperties() in jndi cache is"

                                      + m_config.m_initialContext[i].toProperties());

       

                      if (name.equals(m_config.m_initialContext[i].getName())) {

                          context = new InitialContext(

                                  m_config.m_initialContext[i].toProperties());

                          // synchronize writes to the map as the cache is used by

                          // multiple threads.

                          synchronized (m_contexts) {

                             

                              System.out.println("name and context values are"+name+":"+context);

                              m_contexts.put(name, context);

                          }

                          return context;

                      }

                  }

                  // no definition for name in config file...

                  invalidContextName(name);

              } catch (NamingException ne) {

                  String error = "We were unable to get a connection to the server '"

                          + name

                          + "'. Please check JNDIConfig.xml and make sure that "

                          + "the server is running.";

                  System.out.println(error);

                  throw ne;

              }

              // Will never get here but the compiler needs it...

              return null;

          }