8 Replies Latest reply on Dec 20, 2007 5:04 AM by bidhudas

    javax.naming.NameNotFoundException: queue not bound

    bidhudas

      Hi,

      I am trying to configure JMS queue in JBOSS. I have added the following entry in jbossmq-destinations-service.xml


      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager



      But the same was not listed in JNDIVIEW.

      Whenever I tried to lookup this queue(ctx.lookup(queue/RequestQ) getting the following error. It will be of great help if any body can help in resolving this issue

      javax.naming.NameNotFoundException: queue not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
      at sun.rmi.transport.Transport$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)



      Regards
      Bidhduas

        • 1. Re: javax.naming.NameNotFoundException: queue not bound
          bidhudas

          One correction in the previous mail

          The jbossmq-destinations-service.xml entry is the following


          <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager


          Please help me to resolve this issue at the earliest.

          Thanks in advance
          Bidhudas

          • 2. Re: javax.naming.NameNotFoundException: queue not bound
            bidhudas

            Again the same problem in pasting the mbean details. I just want to mentio that I have added RequestQ in jbossmq-destinations-service.xml

            • 3. Re: javax.naming.NameNotFoundException: queue not bound
              jaikiran

              While posting the xml content use the Code button in message editor window to wrap the contents in a code block. Then use the Preview button to make sure the contents of your post will show up correctly.

              • 4. Re: javax.naming.NameNotFoundException: queue not bound
                jaikiran

                As for the lookup problem, can you post the entire exception stacktrace? Where is the queue being looked up from? If you are looking up the queue from your code then post the code here (and the contents of the jndi.properties, if at all you have one)

                • 5. Re: javax.naming.NameNotFoundException: queue not bound
                  bidhudas

                  See the code I am using for getting queue

                  private static InitialContext getInitialContext() throws NamingException {
                  if(iniCtx == null) {
                  try {
                  InputStream stream = MessageQueue.class.getClassLoader().getResourceAsStream("jndi.properties");
                  Properties prop = new Properties();
                  prop.load(stream);
                  iniCtx = new InitialContext(prop);
                  System.out.println("JNDI " + iniCtx.getEnvironment().toString());
                  } catch (IOException e) {
                  iniCtx = new InitialContext();
                  }
                  }

                  return iniCtx;
                  }

                  private void createQueue(String queueName) throws NamingException, JMSException
                  {
                  queue = (Queue) getInitialContext().lookup(queueName);

                  }



                  and JNDI properties as below

                  java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                  java.naming.provider.url=jnp://127.0.0.1:1099
                  java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces


                  See the stack trace below


                  javax.naming.NameNotFoundException: queue not bound
                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
                  at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
                  at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
                  at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                  at java.lang.reflect.Method.invoke(Unknown Source)
                  at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
                  at sun.rmi.transport.Transport$1.run(Unknown Source)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at sun.rmi.transport.Transport.serviceCall(Unknown Source)
                  at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
                  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
                  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                  ERROR 2007-12-19 08:30:05,156 STDERR: at java.lang.Thread.run(Unknown Source)
                  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
                  at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
                  at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                  at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
                  at javax.naming.InitialContext.lookup(Unknown Source)
                  at org.wipo.das.messaging.MessageQueue.createQueue(MessageQueue.java:123)
                  at org.wipo.das.messaging.MessageQueue.(MessageQueue.java:43)
                  at org.wipo.das.messaging.MessageQueue.get(MessageQueue.java:59)
                  at org.wipo.das.message.user.BusinessResponse.init(BusinessResponse.java:126)
                  at javax.servlet.GenericServlet.init(GenericServlet.java:212)
                  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
                  at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                  at java.lang.Thread.run(Unknown Source)

                  • 6. Re: javax.naming.NameNotFoundException: queue not bound
                    jaikiran

                     

                    at org.wipo.das.message.user.BusinessResponse.init(BusinessResponse.java:126)
                    at javax.servlet.GenericServlet.init(GenericServlet.java:212)


                    Are you doing this logic as part of the init method of your servlet? If so, try moving it to some other place. Maybe when the servlet is being inited the queues are not yet bound.

                    Also, since you are doing the lookup through a servlet (within the same jvm as the server), you dont need a jndi.properties file. Remove that from your application package and change the lookup code to:
                    private static InitialContext getInitialContext() throws NamingException {
                    if(iniCtx == null) {
                    try {
                    iniCtx = new InitialContext();
                    return iniCtx;
                    } catch (Exception e) {
                     //....
                    }
                    }


                    • 7. Re: javax.naming.NameNotFoundException: queue not bound
                      bidhudas

                      Well, I am getting the same error whenever I restart the server. SO I do not think there is any problem with the code. This is something to do with the configuration. As per the information I have whatever the queues added in the jbossmq-destinations-service.xml should list in the JNDIVIEW(in JMX-COSOLE). But this is not happening.

                      • 8. Re: javax.naming.NameNotFoundException: queue not bound
                        bidhudas

                        Can any body give me solution for this??

                        This is related to JNDI issue. So can any body tell how I can move this POST JNDI forum??