web-services - com.ctc.wstx.exc.WstxParsingException : Text size limit

标签 web-services configuration cxf woodstox

我正在向 CXF 网络服务发送一个大附件,但出现以下异常:

Caused by: javax.xml.bind.UnmarshalException - with linked exception: [com.ctc.wstx.exc.WstxParsingException: Text size limit (134217728) exceeded at [row,col {unknown-source}]: [1,134855131]] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:426) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339) at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:769) at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:94) at org.apache.cxf.jaxb.JAXBEncoderDecoder$1.run(JAXBEncoderDecoder.java:797) at java.security.AccessController.doPrivileged(Native Method) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:795) ... 25 more



这个问题似乎来自 Woodstox 图书馆说

Text size limit (134217728) exceeded



有人知道是否可以增加这个限制吗?如果是,怎么办?

最佳答案

如果它像那样来自 woodstox,那么您就不会将它作为 MTOM 附件发送。我的第一个建议是将其翻转为 MTOM,以便它可以在 XML 解析之外进行处理。效率更高,因为我们可以将其作为输入流或类似内容保留,而不将其保存在内存中。

如果要将其保留在 XML 中,可以将属性:“org.apache.cxf.stax.maxTextLength”设置为更大的值。请记住,像这样来自 stax 解析器的内容作为 String 或 byte[] 保存在内存中,因此会消耗内存。

关于web-services - com.ctc.wstx.exc.WstxParsingException : Text size limit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17234017/

相关文章:

java - Apache CXF 拦截器配置

java - 以编程方式配置通过 CXF 启动的 jetty

json - Jackson mixin 注释以包含某些属性并排除其他所有内容

asp.net - 如何强制 ASP.NET Web 服务仅公开 HTTP-POST 接口(interface)

Python 网络服务客户端

intellij-idea - 如何配置 IntelliJ IDEA 从属性文件加载许可证服务器地址?

java - 整合多个部署的 Java webapp 配置文件的策略

java - 配置变更跟踪系统

web-services - 部分 URL : host, 端口、路径

web-services - 如何确保使用 jQuery AJAX 发送到 WebService 的数据是通过我的网站而不是某种攻击