6 Replies Latest reply on Feb 23, 2003 3:04 PM by btarbox

    Linux JNDI Context Problem

    hoguester

      We have a 2.4.3 project running great on Solaris. We ported the same build to a Linux platform and began getting ConnectionException when we try to do lookups off of the InitialContext returned by the jboss server. The session beans we are referencing work fine on the solaris & win2k install but for some reason when we try to do the lookup against the Linux install the exception info indicates its trying to lookup against 127.0.0.1. I am constructing the InitialContext object with a HashMap that contains the IP of the JB server, I am certain its correct and there are no errant JNDI.properties in my classpath. Any ideas??? I have the same application running well on Solaris and Win2k. This issus seems specific to Linux.

        • 1. Re: Linux JNDI Context Problem
          marc.fleury

          nah... I develop and debug and run on Linux...

          something else is at play and for some reason your server doesn't know what 127.0.0.1 is. Try NOT hardcoding your IP and using the jndi.properties instead that will clear some fog

          • 2. Re: Linux JNDI Context Problem
            hoguester

            Thanks for the feedback...
            I tried the JNDI props file, but with the same results. I'm not saying its a bug with Linux as I understand lots of folks deploy there ( I want to as well, and have in the past..with 2.2.x). I feel like the JB server is returning an invalid context to the client (indicating the JNDI context url is 127.0.0.1). Im not 100% clear on how that works behing the scenes. I'll investigate the possibility the JB server doesn't recognize itself as 127.0.0.1. Thanks again.

            • 3. Re: Linux JNDI Context Problem
              gphat

              Eureka!

              For those having a problem similar to this, take a look at your /etc/hosts file. RedHat 7.2 seems to only make one entry, something like:

              127.0.0.1 yurhost yurhost.localdomain.com

              JBoss reads this and returns the address '127.0.0.1' back from your InitialContext call, thinking that is the address of 'yurhost.localdomain.com'.

              Modifying your /etc/hosts file to read:

              127.0.0.1 localhost
              192.168.0.1 yurhost.localdomain.com yurhost

              Seems to resolve the problem. (Do substitute the REAL address of the machine as the second entry, mind you.)

              PS. My quick tests this morning seemed to solve the problem, I'll repost when I'm sure it's fixed.

              • 4. Re: Linux JNDI Context Problem
                quantic

                Yeah, it works on mine too. Thanks a lot, guy. Good work!

                • 5. Re: Linux JNDI Context Problem
                  jwkaltz

                  Hey, this sounds like a new FAQ ;) There were some postings a few weeks ago where I think it was the same problem.
                  Frankly I am surprised to hear of a system where the localhost entry is missing in /etc/hosts
                  As far as I know that line should ALWAYS be present. Are you sure you didn't change the file and that Red Hat 7.2 actually installed it like that ?

                  • 6. Re: Linux JNDI Context Problem
                    btarbox

                    Red Hat 8.0 creates an /etc/hosts file with exactly this form of entry as the only entry. So, this really probably should be in the FAQ, or even the documentation.