9 Replies Latest reply on Jul 23, 2003 8:02 AM by Jon Barnett

    Unable to lookup JNDI_NAME from tomcat server

    dherungula Newbie

      I installed tomcat and Jboss separately at some location as per my requirements.I created a bean with name as TestBean and palced it in deploy directory and in Jboss console it is shown as deployed at location etc.

      I created my sample jsp shown below:

      <%@ page import="java.util.HashMap"%>

      Provisioning


      <%
      try{
      java.util.Hashtable env = new java.util.Hashtable();

      env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      env.put(javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");

      env.put(javax.naming.Context.URL_PKG_PREFIXES, "org.JBoss.naming:org.jnp.interfaces");

      javax.naming.InitialContext ctx = new javax.naming.InitialContext(env);
      Object objref = ctx.lookup("test/Tester");

      tester.TesterHome home = (tester.TesterHome) javax.rmi.PortableRemoteObject.narrow(objref, tester.TesterHome.class);
      tester.Tester remote = home.create();
      System.out.println("The Remote Interface is ***********"+remote);




      }catch(Exception e){
      System.out.println("In Exception block ***********"+e.getMessage());

      }

      %>




      It is working fine if i keep this file in JBoss and i'm able to get the remote interface.

      I want to run same file in tomcat and I placed all the Jar files in WEB-INF/lib of Tomcat and I also placed the EJB-CLIENT.When i try to run the same JSP from tomcat.

      The exception which i'm getting is shown below:
      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      org.apache.jasper.JasperException: Lorg/jboss/tm/TransactionPropagationContextFactory;
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)


      root cause

      javax.servlet.ServletException: Lorg/jboss/tm/TransactionPropagationContextFactory;
      at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
      at org.apache.jsp.Welcome_jsp._jspService(Welcome_jsp.java:146)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
      at java.lang.Thread.run(Thread.java:536)

      I have gone thru google to find out a fix for it.But, i did not anu clue on this.I wud be thankful if anybody gives a clue on this..

      Thanks and Regards,
      Srini

        • 1. Re: Unable to lookup JNDI_NAME from tomcat server
          Jon Barnett Master

          Some people have reported problems with the JBoss client libraries not being found in the WEB-INF/lib directory of their WARs. I cannot say I have tried this configuration.

          However, whenever we have to run a separated installation, we put the JBoss client libraries in Tomcat's shared/lib directory. We have maintained this practice since JBoss 2.4.x. With the more current JBoss distributions, in most cases, you will only need the jbossall-client.jar.

          • 2. Re: Unable to lookup JNDI_NAME from tomcat server
            dherungula Newbie

            I Tried placing jbossall-client.jar in lib of Tomcat Directory.The Exception which i'm getting in tomcat console is shown below:
            javax.naming.NameNotFoundException: Tester not bound
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
            at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
            at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
            at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
            at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
            at sun.rmi.transport.Transport$1.run(Transport.java:148)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
            60)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
            .java:701)
            at java.lang.Thread.run(Thread.java:536)
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
            RemoteCall.java:247)
            at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
            223)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
            at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
            at javax.naming.InitialContext.lookup(InitialContext.java:347)
            at org.apache.jsp.Welcome_jsp._jspService(Welcome_jsp.java:62)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
            .java:210)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
            95)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
            icationFilterChain.java:247)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
            ilterChain.java:193)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
            alve.java:256)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
            alve.java:191)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
            2415)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
            ava:180)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
            rValve.java:171)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
            ava:172)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:641)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
            ve.java:174)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
            t.invokeNext(StandardPipeline.java:643)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:480)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
            3)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
            :594)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
            ssConnection(Http11Protocol.java:392)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
            :565)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
            ool.java:619)
            at java.lang.Thread.run(Thread.java:536)
            In Exception block ***********Tester not bound

            I think port 1099 is not listening.When i try to telnet on my localhost.it's saying connection refused.Do we need to set any parameter in the classpath.Please help




            • 3. Re: Unable to lookup JNDI_NAME from tomcat server
              Jon Barnett Master

              There is nothing else specific. Your problem has moved on as now it appears that you are connecting to the directory but it cannot find the name for which you are searching. I would try checking jmx-console, look at the jndiview list and see the JNDI name for your bean. Whatever is listed there should be the name you use. You are note getting a connection refused message so I'm guessing your JNDI port is properly bound although I can't understand why you cannot telnet localhost 1099.

              • 4. Re: Unable to lookup JNDI_NAME from tomcat server
                dherungula Newbie

                The exception which i'm getting is: ejb not bound.The port no 1099 is not listening

                • 5. Re: Unable to lookup JNDI_NAME from tomcat server
                  Jon Barnett Master

                  Well, the stacktrace you provided doesn't indicate a particular connection refused or port 1099 error and I was going on the stacktrace.

                  However, if you really believe that the JNDI external port has been disabled, in JBoss 3.2.x and 3.0.x server/instance/conf/jboss-service.xml file is:

                  <!-- The listening port for the bootstrap JNP service. Set this to -1
                  to run the NamingService without the JNP invoker listening port.
                  -->
                  1099





                  This is the default and correct setting for the JNDI port to be enabled.

                  Also check your server.log and boot.log for any error messages when your JBoss server starts.

                  • 6. Re: Unable to lookup JNDI_NAME from tomcat server
                    dherungula Newbie

                    Please find the server.log file attached.it says InstanceNotFoundException....

                    • 7. Re: Unable to lookup JNDI_NAME from tomcat server
                      Jon Barnett Master

                      Actually, if you could post the copy of the start up events, it would help us see whether any services failed to start up. We're looking for events before the "Started in xx:xx" line that shows how long JBoss took to start up. It is easier to trace things.

                      • 8. Re: Unable to lookup JNDI_NAME from tomcat server
                        dherungula Newbie

                        Hi,

                        Please find startup events file attached.This file shows all the events occured during the statup of JBoss

                        • 9. Re: Unable to lookup JNDI_NAME from tomcat server
                          Jon Barnett Master

                          Your system seems to be broken in many places but not with the JNDI listener.
                          18:17:32,455 INFO [NamingService] Started jnpPort=1099, rmiPort=0, backlog=50,
                          bindAddress=null, Client SocketFactory=null, Server SocketFactory=null
                          18:17:32,517 INFO [NamingService] Listening on port 1099
                          is the correct log output.

                          mysql-service.xml seems to be an import from 3.0.x. This is not compatible with JBoss 3.2.x. You should be using mysql-ds.xml from examples/dca and modified for your requirements.

                          The centrata.war is having problems deploying. I don't think the servletpluginhelper class exists anymore.

                          You have two tester.jar files. The second one in deploy/test is rejected:
                          18:17:53,408 INFO [JARDeployer] nested deployment: file:/F:/Test/jboss-3.2.1/se
                          rver/default/deploy/test/tester.jar
                          18:17:53,751 INFO [EjbModule] Creating
                          18:17:53,767 INFO [EjbModule] Deploying TesterBean
                          18:17:53,798 INFO [StatelessSessionContainer] Registration is not done -> destr
                          oy
                          18:17:53,814 INFO [StatelessSessionContainer] Stopping
                          18:17:53,814 INFO [StatelessSessionInstancePool] Stopping
                          18:17:53,814 INFO [StatelessSessionInstancePool] Stopped
                          18:17:53,814 INFO [StatelessSessionContainer] Stopped
                          18:17:53,814 INFO [StatelessSessionContainer] Destroying
                          18:17:53,830 INFO [StatelessSessionInstancePool] Destroying
                          18:17:53,830 INFO [StatelessSessionInstancePool] Destroyed
                          18:17:53,830 INFO [StatelessSessionContainer] Destroyed
                          18:17:53,830 ERROR [EjbModule] Initialization failed
                          javax.management.InstanceAlreadyExistsException: jboss.j2ee:jndiName=test/Tester
                          ,service=EJB already registered.

                          I think you need to start with a clean JBoss 3.2.x install and deploy your apps one at a time and resolve each problem before continuing. It may explain why JBoss is not working as you expect.