Could you print the full stack trace; also show the getURL() value in
the blobMessage?
On 8/9/07, Viali.Lee <[EMAIL PROTECTED]> wrote:
>
> 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-feature-doesn%27t-work...-tf4242464s2354.html#a12071923
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>
--
James
-------
http://macstrac.blogspot.com/