1 2 Previous Next 17 Replies Latest reply on Feb 8, 2003 2:21 AM by Michael Behrendt

    Accessing a remote queue

    Stefan Puiu Newbie

      Hello folks, I'm using JBoss 3.0.4 with the 1.4.0 JDK from Sun, compiled from sources, with jbossmq as the JMS implementation. I'm running everything on a Mandrake Linux 9.0.

      I'm trying to send a message to a queue on a different computer here; trouble is, I can't find the exact steps to take to do that in the docs. The approach I've been trying is using JNP to find the JNDI provider on the remote computer ("jnp://"), access the queue by it's name (say "queue/B"), and try to send it a message. But trouble is both lookup("ConnectionFactory") and lookup("queue/B") return null. When an office mate tries to send a message to me, the message gets through, but the JBoss console says something about an exception: "Cannot connect to the ConnectionReceiver/Server". I'm using localhost:8080/jmx-console to verify that messages get through.

      Here's what I do:
      env.put(Context.PROVIDER_URL, "jnp://merlin:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      env.put( Context.SECURITY_PRINCIPAL, "john" );
      env.put( Context.SECURITY_CREDENTIALS, "neddle" );
      InitialContext iniCtx = new InitialContext(env);
      System.out.println ("New context: " + iniCtx + " env: " + env);
      QueueConnectionFactory qcf = (QueueConnectionFactory)
      if (qcf == null) {
      System.out.println ("OOPS");
      //return ;

      What am I doing wrong? Any ideas?

        • 1. Accessing a remote queue (appendix)
          Stefan Puiu Newbie

          Also, I haven't changed anything in the jboss configuration files. Do I need to change anything, like adding a JMS remote provider or something? If so, why do I need to do it?

          • 2. Re: Accessing a remote queue
            Weston Price Newbie

            Trying setting the following option in your run.sh file:

            At the JAVA_OPTS section use


            Bounce the server and give it a shot.


            • 3. Re: Accessing a remote queue
              Jojo Paderes Newbie

              Try using a jndi.properties file to specify the location of the JBoss server where you want to send the message.

              Content of jndi.properties file:


              For the client, here's the sample code that will automatically use the jndi.properties file for location the server. Make sure to add the jndi.properties file to the classpath when running the client app:

              try {
              InitialContext iniCtx = new InitialContext(env);
              QueueConnectionFactory qcf = (QueueConnectionFactory)iniCtx.lookup("ConnectionFactory");
              Queue queue = (Queue) iniCtx.lookup("queue/B");
              QueueSession queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
              QueueSender queueSender = queueSession.createSender(queue);
              TextMessage txtMsg = queueSender.createTextMessage();
              txtMsg.setText("Hello Queue");
              } catch (Exception e) {

              • 4. Re: Accessing a remote queue
                Jojo Paderes Newbie

                correction on line 2:

                InitialContext iniCtx = new InitialContext();

                • 5. Re: Accessing a remote queue
                  Stefan Puiu Newbie

                  wmprince, thank you for your suggestion but the hack doesn't make the error go away. In fact, it doesn't change a thing.

                  I use jnp for JNDI resolution and OIL (which is over TCP/IP, not RMI) for JMS, actually, the second seems to be JBoss's default. Sniffing both the nic and the loopback interface, I can see some RMI activity which is carried out succesfully between me and the destination, so the problem seems to be of a different kind.

                  • 6. Re: Accessing a remote queue
                    Stefan Puiu Newbie

                    Thanks suedehead33, but your solution also doesn't work, setting the environment overrides the properties file, as shown by calling iniCtx.getEnvironment(). Nevertheless, I've tried using the jndi.properties file and commenting out the lines that set up the environment in the client, to no avail. Any other ideas?

                    I've seen some old comments on the forum (a year old ones, all concerning JBoss 2.4.6) saying you need to configure a remote JMS provider. How did things change for JBoss 3.0.x?

                    • 7. Re: Accessing a remote queue
                      Michael Behrendt Newbie

                      I'm still beginner in the JBoss environment, so I can't help you yet. But I can give additional info. Both of the parties (c/s) run on a single W2K machine, using jboss-3.0.5RC1 along with the jdk1.4.0.

                      First, I adopted an MDB example of the J2EE to the JBoss: a client sending 3 msg to the MDB. The server announced the error (1) as described by fane. Msg 2 was received by the MDB! Then the server reported a final error(2):

                      (1) 09:20:34,177 ERROR [OILClientIL] Cannot connect to the ConnectionReceiver/Server
                      09:20:34,378 WARN [OILServerILService] Client request resulted in a server exception:
                      org.jboss.mq.SpyJMSException: Could not pong;
                      (2) 09:20:34,768 INFO [STDOUT] TestMessageDrivenBean.onMessage() got message
                      ERROR: invalid console appender config detected, console stream is looping

                      Then I tried out one of the MDB examples of the JBoss AdminDevel, but with the same result. Here, instead of (2) another warning was given by the server:

                      10:22:03,282 WARN [SecurityManager] No SecurityMetadadata was available for A adding default security conf

                      • 8. Re: Accessing a remote queue
                        Jojo Paderes Newbie

                        I also encountered the same error as described by tristar. I'm running JBoss 3.0.4 in Windows 2000 while my clients are sending messages from Red Hat Linux 8.0.

                        What seems to be the problem here? Do we have to make some configurations on the JBoss server?

                        • 9. Re: Accessing a remote queue
                          Stefan Puiu Newbie

                          Hello tristar,

                          for me JMS works perfectly on the same machine, these problems appear when trying to connect to remote queues (on other computers). The documentation is clearly lacking here.

                          • 10. Re: Accessing a remote queue
                            Jojo Paderes Newbie

                            Hi fane!

                            I think the problem is not with the JBoss server and JMS client app. The "Cannot connect to the ConnectionReceiver/Server" error can be accounted to the /etc/hosts configuration of the linux box you are using.

                            Let's say you have the JMS client app running at (let's use gandalf for the PC's name) and the JBoss server at (merlin). Edit the /etc/hosts for both PCs and use the config contents below:

                   localhost.localdomain localhost

                            After editing, restart the JBoss server. You're client app at "gandalf" should be able to send messages to "merlin" with no problems.

                            We were able to tweak this problem here at our office using Red Hat 8.0/7.3 and Windows 2000. No exception errors so far =D

                            • 11. Re: Accessing a remote queue
                              Michael Behrendt Newbie

                              Hi suedehead33,

                              sounds good - but how to configure hosts on W2K? This evening I will have a laptop available, then I will run the test in the distributed env (but on 2 W2K machines!) ...

                              • 12. Re: Accessing a remote queue
                                Stefan Puiu Newbie

                                Hi suedehead33, I think that could have been the problem, since I had merlin in hosts with an old IP. I have a static address, while merlin was getting its address through DHCP, so it always changes. Now we've made merlin use a static IP and I've put *that* IP in my hosts file.

                                Now we've compiled jboss and the apps using the 1.4.1 JDK and everything works well. Seems that JMS (JNDI) and DHCP don't mix too well.

                                Hey,thanks for your reply and good luck! One problem off my chest :D.

                                • 13. Re: Accessing a remote queue
                                  Jojo Paderes Newbie

                                  To tristar:

                                  For Win2k, you can find the hosts file at WINNT\system32\drivers\etc folder.

                                  To fane:

                                  Nice to hear that your system works perfectly fine now! =D

                                  • 14. Re: Accessing a remote queue
                                    Michael Behrendt Newbie

                                    Hi suedehead33,

                                    thanks a lot for your tips! But it doesn't help. While entity beans and servlets can be accessed remotely (even before changing the hosts file), the message problems remain. ;-(( I will do some other stuff for a while ...

                                    1 2 Previous Next