You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by OnlyLove <v....@gmail.com> on 2007/08/13 11:32:37 UTC

Blob Message is a skin game???

I send the blob message using...

BlobMessage message = session.createBlobMessage(new
URL("http://localhost:8080/test.pdf"));

then, I close the tomcat server, and try to get the message from the amq
broker, 
fail ! (it seems that the blob message just send the url to the broker, but
not the real data of the file!)

Exception in thread "main" java.net.ConnectException: Connection refused:
connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
	at java.net.URL.openStream(Unknown Source)
	at
org.apache.activemq.command.ActiveMQBlobMessage.getInputStream(ActiveMQBlobMessage.java:129)
	at BlobMessagesQueue.BlobConsumer.main(BlobConsumer.java:24)


-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----tf4260124s2354.html#a12123361
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by OnlyLove <v....@gmail.com>.
I appreciate your reply, and thanks.
but it still doesn't work!
I create a BLOB message using a File / InputStream as the command argument.
BlobMessage message =  session.createBlobMessage(new File("E://test.pdf"));
The sending program seems work fine, but when I tried to get the file data
using a consumer, it gets nothing! (the inputstream I get is null,
therefore, nullpoint exception)
I've tried inputstream way too, but failed again...
I strongly recommend folks try and see what happens about the API... 


James.Strachan wrote:
> 
> On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>>
>> I send the blob message using...
>>
>> BlobMessage message = session.createBlobMessage(new
>> URL("http://localhost:8080/test.pdf"));
>>
>> then, I close the tomcat server, and try to get the message from the amq
>> broker,
>> fail ! (it seems that the blob message just send the url to the broker,
>> but
>> not the real data of the file!)
> 
> This is by design. If you create a blob message using a URL, the
> assumption is that the URL points to some hosted file server / web
> server and that is where the data will remain.
> 
> If you want ActiveMQ to actually take ownership of the data, then
> create a BLOB message using a File / InputStream as the command
> argument. See the JavaDoc.
> 
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQSession.html#createBlobMessage(java.net.URL)
> 
> also the documentation explains this
> http://activemq.apache.org/blob-messages.html
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12124829
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by "Viali.Lee" <Vi...@Hotmail.COM>.
I appreciate your reply, and thanks.
but it still doesn't work!
I create a BLOB message using a File / InputStream as the command argument.
BlobMessage message =  session.createBlobMessage(new File("E://test.pdf"));
The sending program seems work fine, but when I tried to get the file data
using a consumer, it gets nothing! 
I've tried inputstream way too, but failed again...
I strongly recommend folks try and see what happens about the API...


James.Strachan wrote:
> 
> On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>>
>> I send the blob message using...
>>
>> BlobMessage message = session.createBlobMessage(new
>> URL("http://localhost:8080/test.pdf"));
>>
>> then, I close the tomcat server, and try to get the message from the amq
>> broker,
>> fail ! (it seems that the blob message just send the url to the broker,
>> but
>> not the real data of the file!)
> 
> This is by design. If you create a blob message using a URL, the
> assumption is that the URL points to some hosted file server / web
> server and that is where the data will remain.
> 
> If you want ActiveMQ to actually take ownership of the data, then
> create a BLOB message using a File / InputStream as the command
> argument. See the JavaDoc.
> 
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQSession.html#createBlobMessage(java.net.URL)
> 
> also the documentation explains this
> http://activemq.apache.org/blob-messages.html
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12124303
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by "Viali.Lee" <Vi...@Hotmail.COM>.
I appreciate your reply, and thanks.
but it still doesn't work!
I create a BLOB message using a File / InputStream as the command argument.
BlobMessage message =  session.createBlobMessage(new File("E://test.pdf"));
The sending program seems work fine, but when I tried to get the file data
using a consumer, it gets nothing! (the inputstream I get is null,
therefore, nullpoint exception)
I've tried inputstream way too, but failed again...
I strongly recommend folks try and see what happens about the API...


James.Strachan wrote:
> 
> On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>>
>> I send the blob message using...
>>
>> BlobMessage message = session.createBlobMessage(new
>> URL("http://localhost:8080/test.pdf"));
>>
>> then, I close the tomcat server, and try to get the message from the amq
>> broker,
>> fail ! (it seems that the blob message just send the url to the broker,
>> but
>> not the real data of the file!)
> 
> This is by design. If you create a blob message using a URL, the
> assumption is that the URL points to some hosted file server / web
> server and that is where the data will remain.
> 
> If you want ActiveMQ to actually take ownership of the data, then
> create a BLOB message using a File / InputStream as the command
> argument. See the JavaDoc.
> 
> http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQSession.html#createBlobMessage(java.net.URL)
> 
> also the documentation explains this
> http://activemq.apache.org/blob-messages.html
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12124303
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by pplive <pp...@gmail.com>.
yep, but fail to start up the file server..
I have no idea how to download the jars I need...
---------------------------------------------------
java.lang.ClassNotFoundException: org.apache.activemq.util.RestFilter
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:375)
        at
org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)


Sherif wrote:
> 
> 
> 
> pplive wrote:
>> 
>> Exception in thread "main" javax.jms.JMSException: Connection refused:
>> connect
>> 
>> Caused by: java.net.ConnectException: Connection refused: connect
>> 
> 
> Did you set up the file server where the file will actually be uploaded?
> You need the "fileserver" webapp to be up and running in the broker's
> embedded web server. Open http://host:port/fileserver in a browser to see
> if it's running. If it's not, check your activemq broker config. You
> should see an entry for the fileserver webapp in the handlers section of
> the jetty config: 
> 
> <jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
> <!-- ... -->
> 	<handlers>
>                 <!-- ... -->
> 		<webAppContext contextPath="/fileserver"
> 				resourceBase="${activemq.base}/webapps/fileserver"
> 				logUrlOnStart="true" />
>                 <!-- ... -->
> 	</handlers>
> </jetty>
> 
> You also have to specify the uploadUrl to the producer. See 
> http://activemq.apache.org/blob-messages.html
> http://activemq.apache.org/blob-messages.html 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12194029
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by pplive <pp...@gmail.com>.
I change the connection option "copyMessageOnSend" to false, it still
failed..
error :(if the option is true, everything is fine)

Exception in thread "main" 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:166)
	at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1577)
	at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:226)
	at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:240)
	at BlobMessagesQueue.BlobProducer.main(BlobProducer.java:24)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.<init>(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.http.HttpClient.New(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown
Source)
	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:163)
	... 4 more



Sherif wrote:
> 
> Hi, 
> 
> I had the same problem. I'm creating the blob message using: 
> 
> BlobMessage message = activeMQSession.createBlobMessage(File);
> 
> The BlobMessage gets sent, but the consumer of the message will have a
> null InputStream (and a null URL). Also, the REST fileserver application
> did not receive the file (although the message is in the queue). 
> 
> When creating the BlobMessage using an URL, everything works fine. Both
> the URL and InputStream are not null and the consumer is able to download
> the message. 
> 
> I found a workaround for it though. If you set the "copyMessageOnSend"
> option to false, things seems to work fine.
> 
> I found this when looking at the behaviour when this option is activated
> (by default). When the message is created with
> activeMQSession.createBlobMessage(File), it sets the message's
> blobUploader field. When the ActiveMQBlobMessage.copy() method is called,
> it does not copy this field. The new message has a null blobUploader.
> Then, when the ActiveMQBlobMessage.onSend() gets called, it does not
> upload the file if the blobUploader field is null. 
> 
> Is this the expected behaviour or a bug? 
> 
> Sherif Behna
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12176125
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game??? not real ?!??

Posted by James Strachan <ja...@gmail.com>.
On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>
> I send the blob message using...
>
> BlobMessage message = session.createBlobMessage(new
> URL("http://localhost:8080/test.pdf"));
>
> then, I close the tomcat server, and try to get the message from the amq
> broker,
> fail ! (it seems that the blob message just send the url to the broker, but
> not the real data of the file!)

This is by design. If you create a blob message using a URL, the
assumption is that the URL points to some hosted file server / web
server and that is where the data will remain.

If you want ActiveMQ to actually take ownership of the data, then
create a BLOB message using a File / InputStream as the command
argument. See the JavaDoc.

http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQSession.html#createBlobMessage(java.net.URL)

also the documentation explains this
http://activemq.apache.org/blob-messages.html

-- 
James
-------
http://macstrac.blogspot.com/

Re: Blob Message is a skin game???

Posted by pplive <pp...@gmail.com>.
God.I have the same problem.
According to what James mentioned, I use  File/Inputstream for the blob
messages, but still can't get anything. It seems that the inputstream
received from the ActiveMQ is null. who knows what's wrong?


James.Strachan wrote:
> 
> Answered in your other thread.
> http://www.nabble.com/Re%3A-Blob-Message-is-a-skin-game----not-real--%21---p12124257s2354.html
> 
> On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>>
>> I send the blob message using...
>>
>> BlobMessage message = session.createBlobMessage(new
>> URL("http://localhost:8080/test.pdf"));
>>
>> then, I close the tomcat server, and try to get the message from the amq
>> broker,
>> fail ! (it seems that the blob message just send the url to the broker,
>> but
>> not the real data of the file!)
>>
>> Exception in thread "main" java.net.ConnectException: Connection refused:
>> connect
>>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>         at java.net.PlainSocketImpl.connect(Unknown Source)
>>         at java.net.Socket.connect(Unknown Source)
>>         at java.net.Socket.connect(Unknown Source)
>>         at sun.net.NetworkClient.doConnect(Unknown Source)
>>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>>         at sun.net.www.http.HttpClient.<init>(Unknown Source)
>>         at sun.net.www.http.HttpClient.New(Unknown Source)
>>         at sun.net.www.http.HttpClient.New(Unknown Source)
>>         at
>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
>> Source)
>>         at
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
>>         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown
>> Source)
>>         at
>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
>> Source)
>>         at java.net.URL.openStream(Unknown Source)
>>         at
>> org.apache.activemq.command.ActiveMQBlobMessage.getInputStream(ActiveMQBlobMessage.java:129)
>>         at BlobMessagesQueue.BlobConsumer.main(BlobConsumer.java:24)
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Blob-Message-is-a-skin-game----tf4260124s2354.html#a12123361
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12138415
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Blob Message is a skin game???

Posted by James Strachan <ja...@gmail.com>.
Answered in your other thread.
http://www.nabble.com/Re%3A-Blob-Message-is-a-skin-game----not-real--%21---p12124257s2354.html

On 8/13/07, OnlyLove <v....@gmail.com> wrote:
>
> I send the blob message using...
>
> BlobMessage message = session.createBlobMessage(new
> URL("http://localhost:8080/test.pdf"));
>
> then, I close the tomcat server, and try to get the message from the amq
> broker,
> fail ! (it seems that the blob message just send the url to the broker, but
> not the real data of the file!)
>
> Exception in thread "main" java.net.ConnectException: Connection refused:
> connect
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>         at java.net.PlainSocketImpl.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at java.net.Socket.connect(Unknown Source)
>         at sun.net.NetworkClient.doConnect(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.openServer(Unknown Source)
>         at sun.net.www.http.HttpClient.<init>(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.http.HttpClient.New(Unknown Source)
>         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
>         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
>         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
>         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
> Source)
>         at java.net.URL.openStream(Unknown Source)
>         at
> org.apache.activemq.command.ActiveMQBlobMessage.getInputStream(ActiveMQBlobMessage.java:129)
>         at BlobMessagesQueue.BlobConsumer.main(BlobConsumer.java:24)
>
>
> --
> View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----tf4260124s2354.html#a12123361
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Re: Blob Message is a skin game??? not real ?!??

Posted by pplive <pp...@gmail.com>.
God.I have the same problem. 
According to what James mentioned, I use  File/Inputstream for the blob
messages, but still can't get anything. It seems that the inputstream
received from the ActiveMQ is null. who knows what's wrong?


OnlyLove wrote:
> 
> I send the blob message using...
> 
> BlobMessage message = session.createBlobMessage(new
> URL("http://localhost:8080/test.pdf"));
> 
> then, I close the tomcat server, and try to get the message from the amq
> broker, 
> fail ! (it seems that the blob message just send the url to the broker,
> but not the real data of the file!)
> 
> Exception in thread "main" java.net.ConnectException: Connection refused:
> connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
> 	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> 	at java.net.PlainSocketImpl.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at java.net.Socket.connect(Unknown Source)
> 	at sun.net.NetworkClient.doConnect(Unknown Source)
> 	at sun.net.www.http.HttpClient.openServer(Unknown Source)
> 	at sun.net.www.http.HttpClient.openServer(Unknown Source)
> 	at sun.net.www.http.HttpClient.<init>(Unknown Source)
> 	at sun.net.www.http.HttpClient.New(Unknown Source)
> 	at sun.net.www.http.HttpClient.New(Unknown Source)
> 	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
> Source)
> 	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
> Source)
> 	at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> 	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
> Source)
> 	at java.net.URL.openStream(Unknown Source)
> 	at
> org.apache.activemq.command.ActiveMQBlobMessage.getInputStream(ActiveMQBlobMessage.java:129)
> 	at BlobMessagesQueue.BlobConsumer.main(BlobConsumer.java:24)
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Blob-Message-is-a-skin-game----not-real--%21---tf4260124s2354.html#a12137483
Sent from the ActiveMQ - User mailing list archive at Nabble.com.