1 2 Previous Next 19 Replies Latest reply on Jan 30, 2004 9:43 AM by priya71

    QueueConnectionFactory lookups wrong host

    sohnj

      Hi,
      I am have jboss instance setup on my local host and on a remote machine.

      I've written a test client to send a queue message to the remote machine with the following:

      java -Djava.naming.provider=jnp://xxxx:1090
      -Djava.naming.factory.initial=org.jnp.interfacts.NamingContextFactory
      -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces.


      Connecting to queuefacorty by:
      QueueConnectionFactory factory = (QueueConnectionFactory)iintialContext.lookup("UILConnectionFactory");

      However, everytime I run the client, it automatically connects to my local server and not the remote instance of JBOSS.


      Any thoughts?
      Thanks!

        • 1. Re: QueueConnectionFactory lookups wrong host

          That's because your JNDI properties are not taken into account. From where are you running this code?

          • 2. Re: QueueConnectionFactory lookups wrong host
            sohnj

            I am running from a seperate project directory for the client.

            Does JBOSS default to localhost when it doesn't find jndi properties?

            I've created other clients, not using JMS/MDB but utililzing session bean in the same manner and it's been working. Are JMS different?

            • 3. Re: QueueConnectionFactory lookups wrong host

              No, it crashes when the properties are not found. Are you sure the properties are ok (name, ip adress, etc)

              Regards,

              Stephane

              • 4. Re: QueueConnectionFactory lookups wrong host
                sohnj

                For the initialcontext, I've added the name of the jndi lookups in the code as follow:

                Hashtable env = new Hashtable();
                env.put(Context.INITAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                env.put(Context.PROVIDER_URL, "xxxxx:1099");
                env.put("java.naming.rmi.security.manager", "yes");
                env.put("Context.URL_PKG_PREFIXES,"org.jboss.naming");

                InitalContext context = new InitialContext(env);

                System.out.println(context.getEnvironment());


                Above code seems to print out the env correctly. Is there any other jndi properties that I need?

                Thanks again!

                • 5. Re: QueueConnectionFactory lookups wrong host

                  Is this the /etc/hosts FAQ?

                  Regards,
                  Adrian

                  • 6. Re: QueueConnectionFactory lookups wrong host

                    Where is this FAQ? I am gonna read it instead of solving already solved issues.

                    Regards,

                    Stephane

                    • 7. Re: QueueConnectionFactory lookups wrong host

                      In the FAQ forum
                      http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= discussion on RMI is irrelevent for JBossMQ unless
                      you are using the RMIConnectionFactory.

                      Regards,
                      Adrian

                      • 8. Re: QueueConnectionFactory lookups wrong host
                        parlor

                        I am actually having the same or a similar problem. I am running Jboss 3.2.2 on both client and server. I create the initial context to the remote machine. jnp://192.168.100.x:1099 but the queue connection is made to a local queue. The lookups I do are for ConnectionFactory (Which is the OIL provider, I have also tries UIL2)

                        The odd thing is that if the server is not available the lookup of the Queue instance fails. If the server is up the queue is created then the Connection Factory, session etc. However, all messages sent end up at the local MDB instead of at the servers.

                        • 9. Re: QueueConnectionFactory lookups wrong host
                          parlor

                          Just as a FYI. The same code works great under JBoss 3.2.1.

                          • 10. Re: QueueConnectionFactory lookups wrong host
                            parlor

                            A little furthur info. The code also works correctly when using RMIConnectionFactory. The problem seems directly related to the new jboss.bind.address feature in 3.2.2. It seems that the JMS connection types are not binding or at least accepting remote connections to them. I tried setting jboss.bind.address to my machines IP and Hostname on startup via run.sh but this caused local queries to jnp://localhost:1099 to fail. I then modified, as a test, uil2-service.xml to bind to the machines address and connections could then be achieved. However modifying uil2's bind address is not a viable solution.

                            I am not sure what the proper configuration settings are now with 3.2.2 to allow remote JMS connections and also allow JNDI lookups to localhost. Can anyone help with this?

                            • 11. Re: QueueConnectionFactory lookups wrong host
                              chuckharris

                              If you find the solution to the problem you are experiencing, please post it. I am experiencing a similar problem.

                              • 12. Re: QueueConnectionFactory lookups wrong host

                                Check /etc/hosts do you have

                                127.0.0.1 localhost.localdomain localhost myhost.com

                                Fix it.

                                127.0.0.1 localhost.localdomain localhost
                                1.2.3.4 myhost.com

                                That is a simple summary of the FAQ mentioned above.
                                There are other possiblities.

                                Connecting to the wrong server => misconfigured network
                                settings.,

                                Regards,
                                Adrian

                                • 13. Re: QueueConnectionFactory lookups wrong host
                                  parlor

                                  The client is running WinXP. The server is running RH 9. The hosts file is the correct form.

                                  127.0.0.1 localhost.localdomain localhost
                                  192.168.100.119 host host.myhost.com


                                  I find it odd that code works under 3.2.1 but not 3.2.2. The code will work under 3.2.2 if I use either the RMIConnectionFactory or if I modify uil2-service.xml to bind to 192.168.100.119.

                                  We also verified that jboss on the server seems to listening on port 8093 by telneting to the port from the Windows machine. We also ran a windump and tcpdump on the appropriate machines. When UIL2 is bound to 0.0.0.0 we don't see any packets transmitted except for the JNDI calls on port 1099. If we bind UIL to the specific IP on the server then the tcp packet traffic goes through.

                                  I also created a JMS client to remove JBoss from the client side to test only the connection to the server. When I attempt to create the queue connection it now throws a JMSException with a root socket exception - connection refused. Is it possible that the JNDI call to the server is returning the wrong location when UIL2 is bound to 0.0.0.0 on the server?

                                  Thanks,
                                  Phil

                                  • 14. Re: QueueConnectionFactory lookups wrong host
                                    chuckharris

                                    Both my client and host are win2k and both host files looked like
                                    127.0.0.1 localhost

                                    Usually, I use computer name or IP. So if the client is
                                    ip 123.123.123.123
                                    name client-11111
                                    app server is
                                    ip 789.789.789.789
                                    name app-22222
                                    what should each host file look like?

                                    1 2 Previous Next