11 Replies Latest reply on Mar 16, 2004 4:23 PM by luigifonti

    Remote clients JNDI problem


      I'have an old problem, already posted in this forum without finding a solution.

      I Installed Jboss 3.2 on a Linux machine. The deployed applications can only be reached from local clients. Remote clients always get an object not found exception.

      jmx-console sees all the objects correctly bound.

      I've tried all the possible ways to define a jndi environment on the client side (jndi.properties, and different source level solutions):


      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
      props.setProperty( "java.naming.provider.url", "jnp://" );
      props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      Context jndiContext = new InitialContext(props);

      env = new Hashtable();
      InitialContext jndiContext = new InitialContext(env);

      But none of them changed the result. What I'm asking now is the following:

      Is there a way to get the list of names of EJB's bound in jboss , using a remote client ? (not jmx-console, which is a servlet, i.e. a local object).

        • 1. Re: Remote clients JNDI problem

          Your second set seems to be correct. Can you try by doing a "env = new Properties()". Additionally, have you tried by using the environment as VM parameters instead of creating a new Property? Something like -Djava.naming.provider.url= etc...

          Additionally, you can also try by doing a System.setProperty on these values and use the default constructor of InitialContext.

          • 2. Re: Remote clients JNDI problem

            Thanks, but none of your suggestion works, sorry.

            My question is:

            Is there a way to list all the bounded names in jboss server, using a remote client (not jmx-console) ?

            • 3. Re: Remote clients JNDI problem

              Have a look at the JNDI API.

              • 4. Re: Remote clients JNDI problem



                • 5. Re: Remote clients JNDI problem

                  Yes I have already tried Context.list() and Context.listBindings(), but these methods require a name as parameter. What a name should I pass as parameter to list all the bindings ? I tried with "*", with "all" and more, but the result is always the same: object not found in table.

                  All the jboss installations I made on Windows XP work perfectly. Only this one on Mandrake Linux ha this crazy problem.

                  • 6. Re: Remote clients JNDI problem

                    Try ""

                    Also check /etc/hosts for
           localhost myhost.com
                    then read the FAQ forum


                    • 7. Re: Remote clients JNDI problem

                      OK, I tried now Context.listBindings(""), i.e. the empty name which should represent the Context itself.

                      Again, I have the error: object not found in table.

                      I am sure the problem is not on client side: if I try with different external servers (Win XP), things work. Only that damned server on Mandrake Linux gives this kind of problem.

                      Do you know if there are working jboss servers on that platform ?

                      • 8. Re: Remote clients JNDI problem

                        Exactly. With the config I show above, the server will tell the client to connect to
                        itself. i.e.

                        You can get more details if you enable
                        log4j TRACE logging for "org.jnp" on the client.


                        • 9. Re: Remote clients JNDI problem

                          OK, I've found a trick to get it working !

                          in /etc/hosts I wrote:


                          in place of:


                          i.e. I assigned to 'localhost' the address defined by DHCP.
                          But if the address changes, should I edit /etc/hosts every time ?

                          • 10. Re: Remote clients JNDI problem

                            I have seen that this problem is not specific to jboss, but more generally involves RMI.

                            With localhost defined as in /etc/hosts, RMI based servers refuse servicing the requests, and force remote clients to address the node (i.e. the client itself).

                            If you assign to localhost the real machine IP address, things work.

                            I would like to know if this is a Mandrake bug, or more generally a Linux bug.

                            • 11. Re: Remote clients JNDI problem

                              I have found a better solution now. In /etc/hosts, I added a second line associating the real IP address of the Linux machine to an IP name, instead of changing the localhost definition:


                              With this addition things work fine.
                              Loooking around in forums I have seen that this is a well known problem with jboss under linux, and it should be listed in FAQ.

                              Luigi Fonti