6 Replies Latest reply on Sep 24, 2003 5:30 PM by Amit Basu

    JMS over http: server pong problem when client behind firewa

    Amit Basu Newbie

      I have a problem while doing JMS over http. JMS topic based communication over http on port 8080 between Java client and JBOSS 3.2.1 server works fine. But if I enable TCP/IP filtering, and filter out TCP ports in the Windows XP Advanced TCP/IP Settings in client, then although client successfully sends JMS message to server and server receives it, server when publishing to the topic to reply, gets following exception. I tried looking up UILConnectionFactory and also UIL2ConnectionFactory instead of just ConnectionFactory, when looking up topic connection factory, but the stack trace below shows JBOSS server goes back to pong with OIL layer. I want the pong to happen with UIL (or preferably UIL2). Since the JBossBook_304 clearly states that OIL IL should not be used by clients sitting behind firewall, how do I force UIL2 usage ?

      Thanks in advance for any help.

      - amit.

      **************** STACK TRACE ON JBOSS LOG BELOW *************************

      va.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.(Socket.java:309)
      at java.net.Socket.(Socket.java:153)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175
      )
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.pong(OILClientIL.java:112)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.
      java:837)
      at org.jboss.mq.server.JMSServerInterceptorSupport.ping(JMSServerInterce
      ptorSupport.java:308)
      at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:7
      12)
      at org.jboss.mq.server.JMSServerInvoker.ping(JMSServerInvoker.java:310)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
      java:324)
      at java.lang.Thread.run(Thread.java:534)
      13:59:50,380 WARN [OILServerILService] Client request resulted in a server exce
      ption:
      org.jboss.mq.SpyJMSException: Could not pong; - nested throwable: (java.rmi.Remo
      teException: Cannot connect to the ConnectionReceiver/Server)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.
      java:841)
      at org.jboss.mq.server.JMSServerInterceptorSupport.ping(JMSServerInterce
      ptorSupport.java:308)
      at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:7
      12)
      at org.jboss.mq.server.JMSServerInvoker.ping(JMSServerInvoker.java:310)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.
      java:324)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Se
      rver
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183
      )
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.pong(OILClientIL.java:112)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.
      java:837)
      ... 5 more
      13:59:50,572 ERROR [OILClientIL] Cannot connect to the ConnectionReceiver/Server
      java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.(Socket.java:309)
      at java.net.Socket.(Socket.java:153)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175
      )
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.receive(OILClientIL.java:130)
      at org.jboss.mq.server.ClientConsumer.doWork(ClientConsumer.java:284)
      at org.jboss.mq.threadpool.ThreadPool$WorkerThread.run(ThreadPool.java:2
      30)
      13:59:50,573 WARN [ClientConsumer] Could not send messages to a receiver.
      java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183
      )
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.receive(OILClientIL.java:130)
      at org.jboss.mq.server.ClientConsumer.doWork(ClientConsumer.java:284)
      at org.jboss.mq.threadpool.ThreadPool$WorkerThread.run(ThreadPool.java:2
      30)
      13:59:50,574 ERROR [JMSDestinationManager] The connection to client ID:2 failed.
      13:59:50,576 ERROR [OILClientIL] Cannot connect to the ConnectionReceiver/Server
      java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.(Socket.java:309)
      at java.net.Socket.(Socket.java:153)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175
      )
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.close(OILClientIL.java:72)
      at org.jboss.mq.server.JMSDestinationManager.connectionClosing(JMSDestin
      ationManager.java:578)
      at org.jboss.mq.server.JMSDestinationManager.connectionFailure(JMSDestin
      ationManager.java:597)
      at org.jboss.mq.server.ClientConsumer.doWork(ClientConsumer.java:292)
      at org.jboss.mq.threadpool.ThreadPool$WorkerThread.run(ThreadPool.java:2
      30)

        • 1. Re: JMS over http: server pong problem when client behind fi
          Stephane Nicoll Master

          > how do I force UIL2 usage

          Use the good connection factory. UIL2ConnectionFactory instead of the generic ConnectionFactory

          Regards,

          Stephane

          • 2. Re: JMS over http: server pong problem when client behind fi
            Amit Basu Newbie

            As I mentioned in my post, I have tried UIL2ConnectionFactory lookup on both client and server, but the server pong still goes out on the OIL layer.

            • 3. Re: JMS over http: server pong problem when client behind fi
              Adrian Brock Master

              If the pong goes on OIL you are not using UIL2

              lookup("UIL2ConnectionFactory");

              Regards,
              Adrian

              • 4. Re: JMS over http: server pong problem when client behind fi
                Amit Basu Newbie

                Hi Adrian,

                On the JBOSS server, I am looking up UIL2ContextFactory (UIL2Service is started on port 8093, but provider URL is using JNDI lookup via http on port 8080), I set up a topic in jbossmq-destinations-service.xml file WITHOUT any invocation layer binding. When client (on another machine) sends message, server gets it allright, so subscription on topic OK, but then server does pong (before publishing reply, and after receiving request), and that's where it gets the exception. I'm giving the code sequence on server below.

                - amit.

                System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.HttpNamingContextFactory");
                System.setProperty(Context.PROVIDER_URL, "http://localhost:8080/invoker/JNDIFactory");
                InitialContext ctx = new InitialContext();
                TopicConnectionFactory fact = (TopicConnectionFactory) ctx.lookup("UIL2ConnectionFactory");
                mTopic = (Topic)ctx.lookup("topic/CommServer");
                mTopicConn = fact.createTopicConnection();
                mSession = mTopicConn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                TopicSubscriber subscriber = mSession.createSubscriber(mTopic, "JMSType='sctrl'", true); // using message selector
                subscriber.setMessageListener(this); // class implements MessageListener
                mPublisher = mSession.createPublisher(mTopic);
                mPublisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                mPublisher.setDisableMessageTimestamp(true);
                mTopicConn.start();

                • 5. Re: JMS over http: server pong problem when client behind fi
                  Adrian Brock Master

                  > Hi Adrian,
                  >
                  > On the JBOSS server, I am looking up
                  > UIL2ContextFactory (UIL2Service is started on port
                  > 8093, but provider URL is using JNDI lookup via http
                  > on port 8080),

                  The mechanism to lookup jndi makes no difference.

                  > I set up a topic in
                  > jbossmq-destinations-service.xml file WITHOUT any
                  > invocation layer binding.

                  Destinations are not tied to invocation layers.

                  > When client (on another
                  > machine) sends message, server gets it allright, so
                  > subscription on topic OK,

                  How do you know it gets it? You have noLocal=true
                  so it cannot get messages it publishes.

                  > but then server does pong
                  > (before publishing reply, and after receiving
                  > request), and that's where it gets the exception. I'm
                  > giving the code sequence on server below.

                  You mean the client correct? I don't see any
                  reference to OIL.

                  Try enabling TRACE for org.jboss.mq on the client
                  (you'll need a log4j.properties in the classpath)
                  and the server (edit conf/log4j.xml)
                  Then post the log results.

                  >
                  > - amit.
                  >
                  > System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                  > "org.jboss.naming.HttpNamingContextFactory");
                  > System.setProperty(Context.PROVIDER_URL,
                  > "http://localhost:8080/invoker/JNDIFactory");
                  > InitialContext ctx = new InitialContext();
                  > TopicConnectionFactory fact =
                  > (TopicConnectionFactory)
                  > ctx.lookup("UIL2ConnectionFactory");
                  > mTopic = (Topic)ctx.lookup("topic/CommServer");
                  > mTopicConn = fact.createTopicConnection();
                  > mSession = mTopicConn.createTopicSession(false,
                  > Session.AUTO_ACKNOWLEDGE);
                  > TopicSubscriber subscriber =
                  > mSession.createSubscriber(mTopic, "JMSType='sctrl'",
                  > true); // using message selector
                  > subscriber.setMessageListener(this); // class
                  > implements MessageListener
                  > mPublisher = mSession.createPublisher(mTopic);
                  > mPublisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT
                  > ;
                  > mPublisher.setDisableMessageTimestamp(true);
                  > mTopicConn.start();
                  >

                  Regards,
                  Adrian

                  • 6. Re: JMS over http: server pong problem when client behind fi
                    Amit Basu Newbie

                    Hi Adrian,

                    Problem solved. Everything works fine. UIL2ConnectionFactory was not being used, as an old class was downloaded over webstart from server.

                    Sorry for creating confusion.

                    - amit.