You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by muadd <ks...@gmail.com> on 2010/02/16 10:05:59 UTC

Re: Bytesmessage and http transport

Hi,

I've encountered similar problem with http transport. When I try to get a
message with 100KB+ payload (tried TextMessage and MapMessage), I get:

2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1 - /
java.io.UTFDataFormatException: encoded string too long: 219486 bytes
	at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
	at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
	at
org.apache.activemq.transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
	at
org.apache.activemq.transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:320)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)

I tried 5.2.0 and 5.3.0 versions. If I switch to tcp transport it works ok.
I'll submit Jira for this because I don't think there is one already.

thanks



Dejan Bosanac wrote:
> 
> Hi,
> 
> The max message size use can send over HTTP is limited by max POST size
> Jetty server will accept. I thinks it's 1MB by default, so it shouldn't
> cause the problem you're seeing. Can you reproduce the problem reliably
> (with the test case ideally) and file it as a Jira issue?
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Thu, Feb 12, 2009 at 12:45 PM, libert <ae...@a-l.fr> wrote:
> 
>>
>> Hi,
>>
>> I'm trying to send a BytesMessage (size : 1 MB max) using HTTP transport
>> but
>> it does not work.
>>
>> In the ActiveMQ console, I get this :
>> java.io.UTFDataFormatException: encoded string too long: 208555 bytes
>>
>> If I switch to openwire TCP, program is working fine ...
>>
>> Is there any message size limit on HTTP transport ?
>>
>> I'm using ActiveMQ 5.2.0 win32
>>
>> Thanks.
>> --
>> View this message in context:
>> http://www.nabble.com/Bytesmessage-and-http-transport-tp21974419p21974419.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: http://old.nabble.com/Bytesmessage-and-http-transport-tp21974419p27605308.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Bytesmessage and http transport

Posted by Dejan Bosanac <de...@nighttale.net>.
Thanks for pointing to this fix Tim.

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Feb 16, 2010 at 2:42 PM, Timothy Bish <ta...@gmail.com> wrote:

> On Tue, 2010-02-16 at 05:13 -0800, muadd wrote:
> > Hi,
> > in order to reproduce this, it should be enough to follow these steps
> (I'm
> > assuming 5.2.0 windows binaries):
> > 1) Add <transportConnector name="http" uri="http://172.18.131.66:61223"
> />
> > to your activemq.xml config file in transportConnectors (change the uri
> to
> > match your ip address)
> > 2) run consumer and producer ant build provided as examples with the
> > distribution, with the following parameters:
> > consumer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> > producer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> > -DmessageSize=100000
> > (again, with appropriate url parameter)
> > 3) the moment amq tries to deliver first message to the consumer (i.e.
> > render the response to the HTTP GET request), the exception occurs
> >
> > The reason for the problem - so it seems - is the use of java
> > DataOutputStream.writeUTF - the implementation being limited to 64k
> buffer.
> > The workaround I'd suggest is to use the OutputStreamWriter instead:
> > OutputStreamWriter out = new OutputStreamWriter(stream, "UTF-8");
> > out.write(message);
> >
> > best regards
> >
>
> This issue should be fixed in the 5.4 SNAPSHOT builds, I'd recommend you
> give that a try.  The same issue was reported previously, see:
>
> https://issues.apache.org/activemq/browse/AMQ-1308
>
> Regards
>
>
> >
> > Dejan Bosanac wrote:
> > >
> > > Hi,
> > >
> > > thanks for raising the issue. Is there a chance you can provide a
> > > reproducible test case?
> > >
> > > Cheers
> > > --
> > > Dejan Bosanac - http://twitter.com/dejanb
> > >
> > > Open Source Integration - http://fusesource.com/
> > > ActiveMQ in Action - http://www.manning.com/snyder/
> > > Blog - http://www.nighttale.net
> > >
> > >
> > > On Tue, Feb 16, 2010 at 10:05 AM, muadd <ks...@gmail.com> wrote:
> > >
> > >>
> > >> Hi,
> > >>
> > >> I've encountered similar problem with http transport. When I try to
> get a
> > >> message with 100KB+ payload (tried TextMessage and MapMessage), I get:
> > >>
> > >> 2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1 - /
> > >> java.io.UTFDataFormatException: encoded string too long: 219486 bytes
> > >>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
> > >>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
> > >>        at
> > >>
> > >>
> org.apache.activemq.transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
> > >>        at
> > >>
> > >>
> org.apache.activemq.transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
> > > [cut]
> > >
> > >
> > >
> > > -----
> > > Dejan Bosanac
> > >
> > > Open Source Integration - http://fusesource.com/
> > > ActiveMQ in Action - http://www.manning.com/snyder/
> > > Blog - http://www.nighttale.net
> > >
> >
>
> --
> Tim Bish
>
> Open Source Integration: http://fusesource.com
> ActiveMQ in Action: http://www.manning.com/snyder/
>
> Follow me on Twitter: http://twitter.com/tabish121
> My Blog: http://timbish.blogspot.com/
>
>

Re: Bytesmessage and http transport

Posted by muadd <ks...@gmail.com>.
I've tried the 5.4 snapshot and it works, 
thanks a lot


Timothy Bish wrote:
> 
> 
> This issue should be fixed in the 5.4 SNAPSHOT builds, I'd recommend you
> give that a try.  The same issue was reported previously, see:
> 
> https://issues.apache.org/activemq/browse/AMQ-1308
> 
> Regards
> 
> 
> -- 
> Tim Bish
> 
> Open Source Integration: http://fusesource.com
> ActiveMQ in Action: http://www.manning.com/snyder/
> 
> Follow me on Twitter: http://twitter.com/tabish121
> My Blog: http://timbish.blogspot.com/
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Bytesmessage-and-http-transport-tp21974419p27610461.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Bytesmessage and http transport

Posted by Timothy Bish <ta...@gmail.com>.
On Tue, 2010-02-16 at 05:13 -0800, muadd wrote:
> Hi,
> in order to reproduce this, it should be enough to follow these steps (I'm
> assuming 5.2.0 windows binaries):
> 1) Add <transportConnector name="http" uri="http://172.18.131.66:61223" />
> to your activemq.xml config file in transportConnectors (change the uri to
> match your ip address)
> 2) run consumer and producer ant build provided as examples with the
> distribution, with the following parameters:
> consumer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> producer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> -DmessageSize=100000
> (again, with appropriate url parameter)
> 3) the moment amq tries to deliver first message to the consumer (i.e.
> render the response to the HTTP GET request), the exception occurs
> 
> The reason for the problem - so it seems - is the use of java
> DataOutputStream.writeUTF - the implementation being limited to 64k buffer.
> The workaround I'd suggest is to use the OutputStreamWriter instead:
> OutputStreamWriter out = new OutputStreamWriter(stream, "UTF-8");
> out.write(message);
> 
> best regards
> 

This issue should be fixed in the 5.4 SNAPSHOT builds, I'd recommend you
give that a try.  The same issue was reported previously, see:

https://issues.apache.org/activemq/browse/AMQ-1308

Regards


> 
> Dejan Bosanac wrote:
> > 
> > Hi,
> > 
> > thanks for raising the issue. Is there a chance you can provide a
> > reproducible test case?
> > 
> > Cheers
> > --
> > Dejan Bosanac - http://twitter.com/dejanb
> > 
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> > 
> > 
> > On Tue, Feb 16, 2010 at 10:05 AM, muadd <ks...@gmail.com> wrote:
> > 
> >>
> >> Hi,
> >>
> >> I've encountered similar problem with http transport. When I try to get a
> >> message with 100KB+ payload (tried TextMessage and MapMessage), I get:
> >>
> >> 2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1 - /
> >> java.io.UTFDataFormatException: encoded string too long: 219486 bytes
> >>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
> >>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
> >>        at
> >>
> >> org.apache.activemq.transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
> >>        at
> >>
> >> org.apache.activemq.transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
> > [cut]
> > 
> > 
> > 
> > -----
> > Dejan Bosanac
> > 
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> > 
> 

-- 
Tim Bish

Open Source Integration: http://fusesource.com
ActiveMQ in Action: http://www.manning.com/snyder/

Follow me on Twitter: http://twitter.com/tabish121
My Blog: http://timbish.blogspot.com/


Re: Bytesmessage and http transport

Posted by Rob Davies <ra...@gmail.com>.
Did you try this on 5.4-SNAPSHOT ?- I think there's a fix in trunk
On 16 Feb 2010, at 13:13, muadd wrote:

>
> Hi,
> in order to reproduce this, it should be enough to follow these  
> steps (I'm
> assuming 5.2.0 windows binaries):
> 1) Add <transportConnector name="http" uri="http:// 
> 172.18.131.66:61223" />
> to your activemq.xml config file in transportConnectors (change the  
> uri to
> match your ip address)
> 2) run consumer and producer ant build provided as examples with the
> distribution, with the following parameters:
> consumer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> producer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
> -DmessageSize=100000
> (again, with appropriate url parameter)
> 3) the moment amq tries to deliver first message to the consumer (i.e.
> render the response to the HTTP GET request), the exception occurs
>
> The reason for the problem - so it seems - is the use of java
> DataOutputStream.writeUTF - the implementation being limited to 64k  
> buffer.
> The workaround I'd suggest is to use the OutputStreamWriter instead:
> OutputStreamWriter out = new OutputStreamWriter(stream, "UTF-8");
> out.write(message);
>
> best regards
>
>
> Dejan Bosanac wrote:
>>
>> Hi,
>>
>> thanks for raising the issue. Is there a chance you can provide a
>> reproducible test case?
>>
>> Cheers
>> --
>> Dejan Bosanac - http://twitter.com/dejanb
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>>
>> On Tue, Feb 16, 2010 at 10:05 AM, muadd <ks...@gmail.com> wrote:
>>
>>>
>>> Hi,
>>>
>>> I've encountered similar problem with http transport. When I try  
>>> to get a
>>> message with 100KB+ payload (tried TextMessage and MapMessage), I  
>>> get:
>>>
>>> 2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1  
>>> - /
>>> java.io.UTFDataFormatException: encoded string too long: 219486  
>>> bytes
>>>       at java.io.DataOutputStream.writeUTF(DataOutputStream.java: 
>>> 347)
>>>       at java.io.DataOutputStream.writeUTF(DataOutputStream.java: 
>>> 306)
>>>       at
>>>
>>> org 
>>> .apache 
>>> .activemq 
>>> .transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
>>>       at
>>>
>>> org 
>>> .apache 
>>> .activemq 
>>> .transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
>> [cut]
>>
>>
>>
>> -----
>> Dejan Bosanac
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>
> -- 
> View this message in context: http://old.nabble.com/Bytesmessage-and-http-transport-tp21974419p27608063.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/






Re: Bytesmessage and http transport

Posted by muadd <ks...@gmail.com>.
Hi,
in order to reproduce this, it should be enough to follow these steps (I'm
assuming 5.2.0 windows binaries):
1) Add <transportConnector name="http" uri="http://172.18.131.66:61223" />
to your activemq.xml config file in transportConnectors (change the uri to
match your ip address)
2) run consumer and producer ant build provided as examples with the
distribution, with the following parameters:
consumer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
producer -Durl=http://172.18.131.66:61223 -DsleepTime=1000
-DmessageSize=100000
(again, with appropriate url parameter)
3) the moment amq tries to deliver first message to the consumer (i.e.
render the response to the HTTP GET request), the exception occurs

The reason for the problem - so it seems - is the use of java
DataOutputStream.writeUTF - the implementation being limited to 64k buffer.
The workaround I'd suggest is to use the OutputStreamWriter instead:
OutputStreamWriter out = new OutputStreamWriter(stream, "UTF-8");
out.write(message);

best regards


Dejan Bosanac wrote:
> 
> Hi,
> 
> thanks for raising the issue. Is there a chance you can provide a
> reproducible test case?
> 
> Cheers
> --
> Dejan Bosanac - http://twitter.com/dejanb
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Tue, Feb 16, 2010 at 10:05 AM, muadd <ks...@gmail.com> wrote:
> 
>>
>> Hi,
>>
>> I've encountered similar problem with http transport. When I try to get a
>> message with 100KB+ payload (tried TextMessage and MapMessage), I get:
>>
>> 2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1 - /
>> java.io.UTFDataFormatException: encoded string too long: 219486 bytes
>>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
>>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
>>        at
>>
>> org.apache.activemq.transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
>>        at
>>
>> org.apache.activemq.transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
> [cut]
> 
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: http://old.nabble.com/Bytesmessage-and-http-transport-tp21974419p27608063.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Bytesmessage and http transport

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

thanks for raising the issue. Is there a chance you can provide a
reproducible test case?

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Feb 16, 2010 at 10:05 AM, muadd <ks...@gmail.com> wrote:

>
> Hi,
>
> I've encountered similar problem with http transport. When I try to get a
> message with 100KB+ payload (tried TextMessage and MapMessage), I get:
>
> 2010-02-16 09:37:28,147 | WARN  | / | org.mortbay.log | btpool0-1 - /
> java.io.UTFDataFormatException: encoded string too long: 219486 bytes
>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
>        at java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
>        at
>
> org.apache.activemq.transport.util.TextWireFormat.marshal(TextWireFormat.java:44)
>        at
>
> org.apache.activemq.transport.http.HttpTunnelServlet.doGet(HttpTunnelServlet.java:86)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>        at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>        at org.mortbay.jetty.Server.handle(Server.java:320)
>        at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>        at
>
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>        at
>
> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
>        at
>
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>
> I tried 5.2.0 and 5.3.0 versions. If I switch to tcp transport it works ok.
> I'll submit Jira for this because I don't think there is one already.
>
> thanks
>
>
>
> Dejan Bosanac wrote:
> >
> > Hi,
> >
> > The max message size use can send over HTTP is limited by max POST size
> > Jetty server will accept. I thinks it's 1MB by default, so it shouldn't
> > cause the problem you're seeing. Can you reproduce the problem reliably
> > (with the test case ideally) and file it as a Jira issue?
> >
> > Cheers
> > --
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Feb 12, 2009 at 12:45 PM, libert <ae...@a-l.fr> wrote:
> >
> >>
> >> Hi,
> >>
> >> I'm trying to send a BytesMessage (size : 1 MB max) using HTTP transport
> >> but
> >> it does not work.
> >>
> >> In the ActiveMQ console, I get this :
> >> java.io.UTFDataFormatException: encoded string too long: 208555 bytes
> >>
> >> If I switch to openwire TCP, program is working fine ...
> >>
> >> Is there any message size limit on HTTP transport ?
> >>
> >> I'm using ActiveMQ 5.2.0 win32
> >>
> >> Thanks.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Bytesmessage-and-http-transport-tp21974419p21974419.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > -----
> > Dejan Bosanac
> >
> > Open Source Integration - http://fusesource.com/
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
>
> --
> View this message in context:
> http://old.nabble.com/Bytesmessage-and-http-transport-tp21974419p27605308.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>