7 Replies Latest reply on Jul 29, 2003 12:07 PM by Mark Mills

    remote lookup problems in Linux

    corky Newbie

      Hi, I'm having problems in with a JBOSS server in Linux(Red Hat 8.0). It works perfectly when on Win2k and local lookup. I call
      Context lContext = new InitialContext();
      then when i call
      lContext.lookup("ejb/sample/samplebean");
      it returns null. It works perfectly when i use a Win2k server. What could be the possible cause for this?

      Also when the client call is on the same Linux server, the remote lookup works perfectly...

      Thanks!

        • 1. Re: remote lookup problems in Linux
          Aaron Arnett Newbie

          I am having the same problem. I'm simply trying to access the default jms testTopic and can't get a connection.

          Works fine on the same machine when booted into WinNT (even the same copy of JBoss since I use a shared partition between the two OS's on a dual-boot). But on RedHat8.0 it fails.

          My code looks like:



          try {
          lContext = new InitialContext();
          topicConnectionFactory = (TopicConnectionFactory)
          lContext.lookup("ConnectionFactory");
          topic = (Topic) lContext.lookup(topicName);
          }
          catch (NamingException e) {
          System.out.println("JNDI API lookup failed: " + e.toString());
          }

          try {
          topicConnection = topicConnectionFactory.createTopicConnection();



          The context object is created, but all lookups return nulls. Then the .createTopicConnection() call causes a NullPointerException.


          java.lang.NullPointerException
          at com.lexmark.build.TestNode.TestNode.main(TestNode.java:45)


          I've found where it was suggested to add an entry in /etc/hosts. I did that but no change.

          Anyone have any suggestions?

          Thanks,
          Aaron

          • 2. Re: remote lookup problems in Linux
            Michael Wagner Newbie

            Hi Corky,

            I guess I have a similar problem.
            At the moment I didn't find a solution, but it seems to be a
            firewalling problem.

            When i disable the firewall on the machine with the jboss I
            can lookup and use my beans.
            After enabling the firewall I cannot connect anymore even after accepting all TCP,UDP packages from port 1099 (jndi default port).

            ...I'm using Redhat 7.3 as Server and Windows NT 4.0 as client...

            Hope it helps.
            Mikel

            • 3. Re: remote lookup problems in Linux
              Michael Wagner Newbie

              Hi Corky,

              I guess I have a similar problem.
              At the moment I didn't find a solution, but it seems to be a
              firewalling problem.

              When i disable the firewall on the machine with the jboss I
              can lookup and use my beans.
              After enabling the firewall I cannot connect anymore even after accepting all TCP,UDP packages from port 1099 (jndi default port).

              ...I'm using Redhat 7.3 as Server and Windows NT 4.0 as client...

              Hope it helps.
              Mikel

              • 4. Re: remote lookup problems in Linux
                Michael Wagner Newbie

                Hi Corky,

                something to add relating to firewall:
                you'll have at least to allow input of tcp on ports 1099, 3543 and 4444 for calling ejbs on a firewall protected machine.
                Please, let me know if it helped. ;-)

                So long
                Mikel

                • 5. Re: remote lookup problems in Linux
                  Aaron Arnett Newbie

                  Well...

                  Somewhere between 1) adding the hostname and ip to /etc/hosts 2) adding my client's hostname to hosts.allow, 3) removing all firewalls through Security Configuration and 4) finishing with a reboot to make sure all changes were reflected since I'm not really sure which daemons are affected or if they pick up text file changes automatically, things started working.

                  Incidentally, I found that you can confirm that there are no firewalls applied by running '/sbin/iptables' as root to get a listing. You can also confirm that a process is listening to a given port by running 'netstat'.

                  Aaron

                  • 6. Re: remote lookup problems in Linux
                    Mark Mills Newbie

                    I'm using JBoss server 3.2.1 on RedHat 9.0. I have turned off the firewall and I have verified it using iptables -L. The lokkit application even deleteed the /etc/sysconfig/iptables file for me. So there is nothing there. I can contact the the host using telnet and ssh to I think there are sufficient permissions. Just to be thorough, I did add my remote hosts name to /etc/hosts and to hosts.allow as indicated in an earlier post. Local connection on the RedHat works fine, but the remote connection is refused. I'm pretty sure there is some firewall thing that I'm missing. I'm confident that the jndi.properties file is fine, because I can connect to a win2k box by changing the hostname.
                    Anyone familiar with reducing the security on RH9.0 so this can work? I have a jms publisher and a jms subscriber that work fine locally on the RH9.0 and work fine remotely from win2k to win2k (I know win2k doesn't have much in the way of security on it as I've installed it.)
                    Thanks,
                    Mark

                    • 7. Re: remote lookup problems in Linux
                      Mark Mills Newbie

                      I found the answer under the FAQ searching the string "connection refused". RH Linux puts the local server name in the /etc/hosts file under the loopback address 127.0.0.1 and that is what is returned to the remote publisher when the initial context is created. By deleting the host name from that line and creating a new line with the externally known IP address and the host name I was able to remotely connect (having previously stripped off the security). I did try just deleting the host name, since my machine is using DHCP and putting a static IP address seemed counter-intuitive to me, but JBoss wasn't happy with that. It's also possible that had I rebooted RedHat would have been unhappy as well.
                      Thanks,
                      Mark