12 Replies Latest reply on Nov 29, 2006 1:52 PM by dbrawler

    JBoss/JNDI Lookups Hanging

    dbrawler

      Hey folks,

      When trying to use NamingContext.lookup on our server, it hangs indefinitely. I'm supplying the jndi properties at runtime by using NamingContext.addenvironment(). If I don't supply java.naming.provide.url, the socket times out (as expected). However if I provide the url at jnp://localhost:1099, the .lookup("DataManagerService") hangs indefinitely. I've tried several variations of the provider.url (using real world IP, omitting the port, etc.) but nothing seems to work - it continuously hangs.

      When I telnet to localhost:1099 I do receive a connection along with some data, so I'm confident that the JBoss server is supplying the JNDI tree on the corect (default) port. Is there something else I'm missing? Unforuntately, our server administration is outsourced and the administrator is unavailable for questioning at the moment.

      Anyone have any ideas?

      Much appreciated.

        • 1. Re: JBoss/JNDI Lookups Hanging
          dbrawler

          Here's one of the lookups we are trying to perform (in java):

          InitialContext namingContext = new InitialContext();
          namingContext.addToEnvironment("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
          namingContext.addToEnvironment("java.naming.provider.url","jnp://localhost:1099/");
          namingContext.addToEnvironment("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");

          Object dmObject = namingContext.lookup("DataManagerService");

          • 2. Re: JBoss/JNDI Lookups Hanging
            peterj

            You never said which operating system you are running. Is it Linux? If so, see if the suggestions given at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=93668 help.

            • 3. Re: JBoss/JNDI Lookups Hanging
              dbrawler

              Thanks for the link PeterJ.

              We're running Red Hat Enterprise Linux ES release 4 (Nahant Update 4) for our OS.

              As a test, I tried to lookup a different service, such as JNDIView. When I call lookup() it hangs indefinitely, so the program never returns from the lookup() method at all. I tried the telnet localhost 1099 numerous times, and have even used the IP returned from the telnet command (as discussed in the link PeterJ sent) and still no luck. When I go into the JMX Console, it does say that DataManagerService is running and I can invoke methods from the JMX Console (as well as the JNDIView MBean).

              I'm very new to JBoss and MBeans, unfortunately, and our server administrator is also new to it. Any ideas?

              • 4. Re: JBoss/JNDI Lookups Hanging
                peterj

                Is your lookup code in an application deployed to JBoss or in a separate client application?

                If the former, get rid of all of the addToEnvironment calls.

                If the later, is the client application on the same system as JBoss or on a remote system?

                Did you update your /etc/hosts file as was suggested in my other post? Of course, substituting your IP address in for the one I used.

                • 5. Re: JBoss/JNDI Lookups Hanging
                  dbrawler

                  The lookup code is in a client application, and the client application is on the same machine as JBoss. The /etc/hosts file contains the correct IP address of the machine with the simple & full hostname.

                  If I remove the addToEnvironment, the client app is unable to figure out what JNDI info to use, so it throws the javax.naming.NoInitialContextException exception. I will attempt to replace the addEnvironment calls to a "new Properties(...)" call to see if that helps.

                  In the meantime, have you encountered the "lookup()" call not returning before?

                  • 6. Re: JBoss/JNDI Lookups Hanging
                    dbrawler

                    Follow up: I loaded the environment with "new Properties(..)" and it still hangs on the call to lookup()

                    • 7. Re: JBoss/JNDI Lookups Hanging
                      peterj

                      Many months ago I attempted to connect a client (running on Windows) to JBoss JNDI on Linux and it did not work (can't recall if I got a timeout, or if it hung, or what). Even after setting my iptables properly (you do have ports 1099 and 1098 open?), I still had problems. So I googled the exception and eventually found the solution I outlined in the other post. But as I noted, I'm not sure if the problem was the client hanging.

                      I had another thought. Try running JBoss with the JVM option: -Djava.net.preferIPv4Stack=true
                      Sometimes the JVM gets confused and tries to use a IPv6 stack, this option tells it not do to that.

                      • 8. Re: JBoss/JNDI Lookups Hanging
                        dbrawler

                        Thanks Peter, I've forwarded your suggestion onto our system administrator.

                        Is there a way that I could test if the JNDI stuff is even being exposed on the JBoss server? (like a different test program, ideally written in Java). Also, is there anything I'm missing as far as connection factoriy information from the jndi.properties?

                        • 9. Re: JBoss/JNDI Lookups Hanging
                          peterj

                          To test JNDI, use the jmx-console, select the jboss:service=JNDIView MBean. One the details page, click the invoke button for the list() method. The resulting page displays all of the naming trees.

                          • 10. Re: JBoss/JNDI Lookups Hanging
                            dbrawler

                            Follow up: Ok, I just didn't know if there was another quick Java sample to do it, but that works too. :)

                            The one I'm looking for is located in the Global JNDI Space, called "DataManagerService" (at the root level of the tree). So lookup("DataManagerService") should work just fine (I tried jnp://... but no luck either).

                            • 11. Re: JBoss/JNDI Lookups Hanging
                              dbrawler

                              (sorry I mixed up the jnp:// with java:)

                              • 12. Re: JBoss/JNDI Lookups Hanging
                                dbrawler

                                update: Ok, we tried running JBoss with the -Djava.net.preferIPv4Stack=true and that also did not work. The JBoss server we are running comes with the Adobe LiveCycle product line and is version 3.2.5. We will be talking with Adobe about their "turnkey" setup and installation of JBoss to see if they've encountered any issues like the ones we're having.

                                If anyone has any other suggestions, we would appreciate it!

                                Thanks again.