Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 27113 invoked from network); 9 Aug 2007 12:55:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Aug 2007 12:55:01 -0000 Received: (qmail 41359 invoked by uid 500); 9 Aug 2007 12:54:59 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 41329 invoked by uid 500); 9 Aug 2007 12:54:59 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 41320 invoked by uid 99); 9 Aug 2007 12:54:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2007 05:54:59 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2007 12:54:54 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IJ7X8-00070H-Gn for users@activemq.apache.org; Thu, 09 Aug 2007 05:54:34 -0700 Message-ID: <12071917.post@talk.nabble.com> Date: Thu, 9 Aug 2007 05:54:34 -0700 (PDT) From: "Viali.Lee" To: users@activemq.apache.org Subject: BlobMessage doesn't work... MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: Viali.Lee@Hotmail.COM X-Virus-Checked: Checked by ClamAV on apache.org I download the ActiveMQ 5.0-SNAPSHOT and unzip it, then run /bin/activemq.bat. After that, I wrote a Producer and Consumer to test the BlobMessage feature of ActiveMQ 5.0-SNAPSHOT, but failed!!! Producer.java: import java.io.File; import javax.jms.*; import org.apache.activemq.*; public class Producer { public static void main(String[] args) throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); Connection connection = connectionFactory.createConnection(); connection.start(); ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue("message.larger.input"); MessageProducer producer = session.createProducer(destination); BlobMessage message = session.createBlobMessage(new File("D://1.1K.Test.xml")); producer.send(message); session.close(); connection.close(); } } Consumer.java: import java.io.*; import javax.jms.*; import javax.jms.Message; import org.apache.activemq.*; public class Consumer { public static void main(String[] args) throws Exception { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); Connection connection = connectionFactory.createConnection(); connection.start(); ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue("message.larger.input"); MessageConsumer consumer = session.createConsumer(destination); Message message = consumer.receive(10000); BlobMessage blobMessage = (BlobMessage) message; InputStream in = blobMessage.getInputStream(); byte[] b = new byte[2048]; File file = new File("D://result.xml"); FileOutputStream out = new FileOutputStream(file); while (in.read(b) > 0) { out.write(b); } out.close(); session.close(); connection.close(); } } error: Exception in thread "main" java.lang.NullPointerException the inputstream received by Consumer is null. who knows what happened?? -- View this message in context: http://www.nabble.com/BlobMessage-doesn%27t-work...-tf4242461s2354.html#a12071917 Sent from the ActiveMQ - User mailing list archive at Nabble.com.