使用 Liberty 24.0.0.7,配置了
microProfile-6.1
功能(这意味着 mpRestClient-3.0
和 restfulWSClient-3.1
),我需要发送一个内部包含 byte[44MiB]
的对象(在序列化为 JSON 之后——使用 Jackson——也许由于 Base64 编码,这增加了约 33%)。
代码是:
mapper = new com.fasterxml.jackson.databind.ObjectMapper()
.configure(...); // many jackson related configurations
response = jakarta.ws.rs.client.ClientBuilder
.newBuilder()
.register(new com.fasterxml.jackson.jakarta.rs.json.JacksonXmlBindJsonProvider(mapper, new Annotations[]{Annotations.JACKSON, Annotations.JAKARTA_XML_BIND}))
.register(...)
.connectTimeout(3, TimeUnit.SECONDS)
.property("dev.resteasy.entity.file.threshold", "500MB")
.build()
.property("dev.resteasy.entity.file.threshold", "500MB")
.target("http://host:port/path/to/endpoint")
.request()
.property("dev.resteasy.entity.file.threshold", "500MB")
.post(jakarta.ws.rs.client.Entity.entity(objectContainingBigByteArray, MediaType.APPLICATION_JSON));
;
(看到我已经把
.property("dev.resteasy.entity.file.threshold", "500MB")
铺满了,希望其中一个能被使用——但没有成功)
服务器吐口水
RESTEASY005081:已达到 50MB 的文件限制。无法处理该实体。使用配置属性 dev.resteasy.entity.file.threshold 增加大小
全文:
Caused by: jakarta.ejb.EJBException: See nested exception; nested exception is: jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: RESTEASY005081: File limit of 50MB has been reached. The entity cannot be processed. Increase the size with the configuration property dev.resteasy.entity.file.threshold. (through reference chain: ...->...) at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:401) at [internal classes] ... 117 more Caused by: jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: RESTEASY005081: File limit of 50MB has been reached. The entity cannot be processed. Increase the size with the configuration property dev.resteasy.entity.file.threshold. (through reference chain: ...->...) at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:365) at [internal classes] ... 131 more Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: RESTEASY005081: File limit of 50MB has been reached. The entity cannot be processed. Increase the size with the configuration property dev.resteasy.entity.file.threshold. (through reference chain: ...->...) at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.loadHttpMethod(ManualClosingApacheHttpClient43Engine.java:491) at [internal classes] ... 141 more Caused by: com.fasterxml.jackson.databind.JsonMappingException: RESTEASY005081: File limit of 50MB has been reached. The entity cannot be processed. Increase the size with the configuration property dev.resteasy.entity.file.threshold. (through reference chain: ...->...) at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402) at [internal classes] at com.fasterxml.jackson.jakarta.rs.base.ProviderBase.writeTo(ProviderBase.java:610) at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:261) at [internal classes] ... 142 more Caused by: java.lang.IllegalStateException: RESTEASY005081: File limit of 50MB has been reached. The entity cannot be processed. Increase the size with the configuration property dev.resteasy.entity.file.threshold. at org.jboss.resteasy.spi.EntityOutputStream.checkFileThreshold(EntityOutputStream.java:324) at [internal classes] ... 158 more
我让它与
-Ddev.resteasy.entity.file.threshold=500MB"
一起工作。哈克,但工作。