ERROR [OILClientIL] Cannot connect to the ConnectionReceiver
theblackunicorn Jul 18, 2003 12:40 PMHi,
I'm using JBoss 3.2.1 an am trying to get JMS up and running. I have added a topic by creating a file mdb-service.xml in de deploy/jms directory :
<?xml version="1.0" encoding="UTF-8"?>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
I have written to stand-alone java client programs, one that listens for messages on the topic, and one that sends a message. This is the code :
Receiver :
public MdbTester() {
/* Get connection to JMS topic */
try {
InitialContext jndiContext = new InitialContext();
TopicConnectionFactory factory = (TopicConnectionFactory) jndiContext.lookup("java:/ConnectionFactory");
Topic topic = (Topic) jndiContext.lookup("topic/mdbTopic");
TopicConnection connect = factory.createTopicConnection();
TopicSession session = connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicSubscriber subscriber = session.createSubscriber(topic);
subscriber.setMessageListener(this);
connect.start();
System.out.println("Listening...");
} catch (Exception e) {
e.printStackTrace();
}
}
public void onMessage(Message m) {
System.out.println("MESSAGE RECEIVED");
}
Sender :
public MdbSender() {
try {
InitialContext jndiContext = new InitialContext();
TopicConnectionFactory factory = (TopicConnectionFactory) jndiContext.lookup("java:/ConnectionFactory");
Topic topic = (Topic) jndiContext.lookup("topic/mdbTopic");
TopicConnection connect = factory.createTopicConnection();
TopicSession session = connect.createTopicSession(true,0);
TopicPublisher publisher = session.createPublisher(topic);
TextMessage msg = session.createTextMessage();
msg.setText("Test text");
publisher.publish(msg);
System.out.println("Mesage sent");
connect.close();
} catch (Exception e) {
e.printStackTrace();
}
}
When I run either of these programs against a JBoss server on another computer in the same lan (no firewalls etc), I get this error in the JBoss server.log. The programs don't produce any errors and run as expected (receiver blocks waiting for messages, sender exits)
2003-07-18 10:39:04,420 DEBUG [org.jboss.mq.il.oil.OILClientIL] ConnectionReceiverOILClient is connecting to: 127.0.0.1:43244
2003-07-18 10:39:04,421 ERROR [org.jboss.mq.il.oil.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:434)
at java.net.Socket.connect(Socket.java:384)
at java.net.Socket.(Socket.java:291)
at java.net.Socket.(Socket.java:147)
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(JMSServerInterceptorSupport.java:308)
at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:712)
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:536)
2003-07-18 10:39:04,428 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
org.jboss.mq.SpyJMSException: Could not pong; - nested throwable: (java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server)
at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.java:841)
at org.jboss.mq.server.JMSServerInterceptorSupport.ping(JMSServerInterceptorSupport.java:308)
at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:712)
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:536)
Caused by: java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183)
When I run the programs against a JBoss on the same computer I get no error messages, but the receiver does not receive any messages.
I'm rather new to JMS and I haven't used it on JBoss before so I'm probably doing something very stupid.
Any help would be very much appreciated :)
TbU