activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bzaks1424 <bzaks1...@gmail.com>
Subject Connection Fails when trying to send Blob Message
Date Fri, 26 Feb 2010 00:01:08 GMT

I am trying to send a BlobMessage to a "remote" queue (in this case just to
the "localhost" queue) in ActiveMQ. Whenever I issue the send command from
the producer - the connection is refused. I'll try to provide as much
information as I can.

I'm also *really* new to ActiveMQ. So If you have any suggestions in my
coding practices I'm all ears! (Or I suppose 'eyes' would have to do in this
case)

Tests Performed:
I can enqueue other objects (TextMessage, ObjectMessage....)
I can telnet to the port from my command line (telnet localhost 61616)

Environment:
Windows XP (SP3)
No Firewall
Java 1.6

Code:
try {
	StringBuffer brokerURL = new StringBuffer("tcp://")
			.append("exampleHost");
	if (destinationPort == null) {
		// Use the default
		brokerURL.append(":").append("61616");
	} else {
		brokerURL.append(":").append(destinationPort);
	}

	ActiveMQConnectionFactory factoryBean = null;
	Connection connection = null;
	ActiveMQSession session = null;
	MessageProducer producer = null;
	try {
		factoryBean = new ActiveMQConnectionFactory(brokerURL
				.toString());
		connection = factoryBean.createConnection();
		connection.start();
		session = (ActiveMQSession) connection.createSession(false,
				Session.AUTO_ACKNOWLEDGE);
		Destination payloadQueue = session
				.createQueue("com.example.payload");
		producer = session.createProducer(null);
		BlobMessage blobMessage = session
				.createBlobMessage(remoteWorkItemTO.getPayload());
		blobMessage.setStringProperty("FILENAME",fileName);
		blobMessage.setLongProperty("JOB_ID",jobId);
		producer.send(payloadQueue, blobMessage);
		
	} finally {
		try {
			producer.close();
			session.close();
			connection.stop();
			connection.close();
		} catch (Exception e) {
			// Ignore it.
		}
	}
} catch (Exception e) {
	e.printStackTrace();
}

Abridged Stack Trace:
javax.jms.JMSException: Connection refused: connect
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
	at
org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:176)
	at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1674)
	at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
	at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:300)
..........
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:525)
	at java.net.Socket.connect(Socket.java:475)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
	at sun.net.www.http.HttpClient.New(HttpClient.java:306)
	at sun.net.www.http.HttpClient.New(HttpClient.java:323)
	at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
	at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
	at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
	at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:904)
	at
org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadStream(DefaultBlobUploadStrategy.java:59)
	at
org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadFile(DefaultBlobUploadStrategy.java:44)
	at org.apache.activemq.blob.BlobUploader.upload(BlobUploader.java:51)
	at
org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:173)
	... 37 more
-- 
View this message in context: http://old.nabble.com/Connection-Fails-when-trying-to-send-Blob-Message-tp27714556p27714556.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message