CamelExchangeException:JettyClient失败原因:负初始大小:

时间:2013-12-02 21:29:32

标签: apache-camel apache-karaf

使用Camel 2.8.0
使用Jetty 7.5.4

from("jetty://http://myESBserver/large/resource?matchOnUriPrefix=true&bridgeEndpoint=true&enableMultipartFilter=false&disableStreamCache=true&continuationTimeout=1440000")  
.to("jetty://http://myWEBserver/large/resource?bridgeEndpoint=true&throwExceptionOnFailure=false");

此路线适用于较小的资源。我要求Camel代理请求而不进行修改(在交换完成后进行日志记录)。我试图代理的文件相当大(约7G)。

karaf log:

16:11:15,201 | ERROR | qtp59894565-976  | DefaultErrorHandler              | ?                                   ? | 56 - org.apache.camel.camel-core - 2.8.0 | Failed delivery for exchangeId: ID------46702-1385393650256-95-3. Exhausted after delivery attempt: 1 caught:         org.apache.camel.CamelExchangeException: JettyClient failed cause by: Negative initial size: -1034012518. Exchange[Message: [Body is null]]. Caused by: [java.lang.IllegalArgumentException - Negative initial size: -1034012518]
org.apache.camel.CamelExchangeException: JettyClient failed cause by: Negative initial size: -1034012518. Exchange[Message: [Body is null]]. Caused by: [java.lang.IllegalArgumentException - Negative initial size: -1034012518]
    at org.apache.camel.component.jetty.JettyContentExchange.doTaskCompleted(JettyContentExchange.java:205)[86:org.apache.camel.camel-jetty:2.8.0]
    at org.apache.camel.component.jetty.JettyContentExchange.onException(JettyContentExchange.java:135)[86:org.apache.camel.camel-jetty:2.8.0]
    at org.eclipse.jetty.client.HttpExchange$Listener.onException(HttpExchange.java:1094)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:319)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)[69:org.eclipse.jetty.io:7.5.4.v20111024]
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)[69:org.eclipse.jetty.io:7.5.4.v20111024]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)[77:org.eclipse.jetty.util:7.5.4.v20111024]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)[77:org.eclipse.jetty.util:7.5.4.v20111024]
    at java.lang.Thread.run(Thread.java:662)[:1.6.0_31]
Caused by: java.lang.IllegalArgumentException: Negative initial size: -1034012518
    at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:57)[:1.6.0_31]
    at org.eclipse.jetty.client.ContentExchange.onResponseContent(ContentExchange.java:99)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpExchange$Listener.onResponseContent(HttpExchange.java:1163)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection$Handler.content(HttpConnection.java:657)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801)[74:org.eclipse.jetty.http:7.5.4.v20111024]
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224)[74:org.eclipse.jetty.http:7.5.4.v20111024]
    at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:279)[72:org.eclipse.jetty.client:7.5.4.v20111024]
    ... 5 more

1 个答案:

答案 0 :(得分:0)

代码在内部使用ByteArrayOutputStream,其最大大小限制为Integer.MAX_VALUE - 约2GB。

在此之前还有另一个错误,即long会以某种方式被降级为整数,但ByteArrayOutputStream似乎是根本问题。

因此,您似乎必须将数据拆分为单独的块或使用不同的方法。