1 Reply Latest reply on Dec 21, 2011 12:46 PM by Prashant Punekar

    jndi lookup error from a jboss module

    Prashant Punekar Newbie

      Here is the standalone.xml configuration for the resource adaptor.

       

      <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                  <resource-adapters>

                      <resource-adapter>

                          <archive>

                              AAAdapter.rar

                          </archive>

                          <connection-definitions>

                              <connection-definition class-name="com.aa.resource.AAManagedConnectionFactory" jndi-name="AAAdapter">

                                  <config-property name="port">

                                      80

                                  </config-property>

                                  <config-property name="sslPort">

                                      443

                                  </config-property>

                                  <config-property name="host">

                                      nucleus.integration.aa.com

                                  </config-property>

                              </connection-definition>

                          </connection-definitions>

                      </resource-adapter>

                  </resource-adapters>

              </subsystem>

       

      Here is the java code to access the connection using jndi:

       

                          Properties env = new Properties();

                         env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");

                         env.setProperty("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");

                          Context ctx = new InitialContext(env);

       

      /*                  Properties props = new Properties();

                          props.setProperty("java.naming.factory.initial", "org.jboss.naming.NamingContextFactory");

                          props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

                          //props.setProperty("java.naming.provider.url", "jnp://localhost:1199");

                          Context ctx = new InitialContext(props);

      */                  AAConnectionFactory connFactory = (AAConnectionFactory)ctx.lookup("java:/AAAdapter");

                          AAConnection eaConn = connFactory.getConnection();

       

      Error with the above code is :

       

      17:43:26,603 ERROR [stderr] (http--127.0.0.1-9090-1) javax.naming.NamingException: Local server is not initialized

      17:43:26,603 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)

      17:43:26,604 ERROR [stderr] (http--127.0.0.1-9090-1)    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

      17:43:26,607 ERROR [stderr] (http--127.0.0.1-9090-1)    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

      17:43:26,611 ERROR [stderr] (http--127.0.0.1-9090-1)    at javax.naming.InitialContext.init(InitialContext.java:223)

      17:43:26,612 ERROR [stderr] (http--127.0.0.1-9090-1)    at javax.naming.InitialContext.<init>(InitialContext.java:197)

      17:43:26,614 ERROR [stderr] (http--127.0.0.1-9090-1)    at LoginImpl.getAccountInfo(LoginImpl.java:42)

      17:43:26,615 ERROR [stderr] (http--127.0.0.1-9090-1)    at LoginServiceImpl.getAccountInfo(LoginServiceImpl.java:17)

      17:43:26,617 ERROR [stderr] (http--127.0.0.1-9090-1)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      17:43:26,619 ERROR [stderr] (http--127.0.0.1-9090-1)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      17:43:26,620 ERROR [stderr] (http--127.0.0.1-9090-1)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      17:43:26,622 ERROR [stderr] (http--127.0.0.1-9090-1)    at java.lang.reflect.Method.invoke(Method.java:597)

      17:43:26,623 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)

      17:43:26,625 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255)

      17:43:26,640 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220)

      17:43:26,654 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209)

      17:43:26,655 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519)

      17:43:26,656 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496)

      17:43:26,658 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)

      17:43:26,674 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)

      17:43:26,675 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)

      17:43:26,677 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)

      17:43:26,678 ERROR [stderr] (http--127.0.0.1-9090-1)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      17:43:26,680 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)

      17:43:26,682 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

      17:43:26,683 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

      17:43:26,685 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)

      17:43:26,686 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151)

      17:43:26,688 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)

      17:43:26,690 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      17:43:26,703 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

      17:43:26,704 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

      17:43:26,706 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      17:43:26,720 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

      17:43:26,722 ERROR [stderr] (http--127.0.0.1-9090-1)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

      17:43:26,723 ERROR [stderr] (http--127.0.0.1-9090-1)    at java.lang.Thread.run(Thread.java:662)

      17:43:26,725 ERROR [SovereignLogger] (http--127.0.0.1-9090-1) Exception Error - Local server is not initialized

       

      Appreciate urgent help on this issue.

       

      Regards,

      Prashant

        • 1. Re: jndi lookup error from a jboss module
          Prashant Punekar Newbie

          Here is the module.xm for the module from which I am trying to do the jndi lookup.

           

          <module xmlns="urn:jboss:module:1.0" name="com.aa.sgn.sl.logincore">
              <resources>
                  <resource-root path="logincore-1.0.0-SNAPSHOT.jar"/>
            <resource-root path="jnet-3.2.1.jar" />
            <resource-root path="jnp-client.jar" />
            <!--resource-root path="jboss-3.2.1.jar" /-->
            <resource-root path="rt.jar" />
            <!-- resource-root path="jndi-1.2.1.jar" /-->
                  <!-- Insert resources here -->
              </resources>
          <dependencies>
            <module name="org.jboss.logging"/>
            <module name="org.apache.httpcomponents"/>
            <!-- module name="jboss"/-->
            </dependencies>
          </module>