jax-ws之CXF之Jboss AS 7 : org. apache.cxf.staxutils.DepthExceededStaxException 中的 Jaxws 问题:达到 innerElementCountThreshold:50000

EasonJim 阅读:20 2024-11-01 17:39:52 评论:0

在处理 SOAP 网络服务响应时,我在 Jaxws 客户端中遇到了一个异常,这个异常很大。这在 Jboss 5.1 中运行良好。但是我将 Jboss 升级到 AS 7 并开始出现以下错误。

Caused by: javax.xml.ws.soap.SOAPFaultException: reach the innerElementCountThreshold:50000 
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157) 
    at com.sun.proxy.$Proxy41.getAllJobHistory(Unknown Source) 
    at com.ep.service.impl.StatusSearchServiceImpl.findAll(StatusSearchServiceImpl.java:38) [classes:] 
    at com.ep.controller.StatusBean.retrieveHistoryList(StatusBean.java:145) [classes:] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_45] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_45] 
    at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45] 
    at org.apache.el.parser.AstValue.invoke(AstValue.java:258) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] 
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] 
    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) [jsf-facelets-1.1.15.jar:1.1.15] 
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jsf-api-1.2_15-b01-redhat-3.jar:1.2_15-b01-redhat-3] 
    ... 31 more 
Caused by: org.apache.cxf.staxutils.DepthExceededStaxException: reach the innerElementCountThreshold:50000 
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1199) 
    at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1129) 
    at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:223) 
    at org.apache.cxf.jaxws.handler.soap.SOAPMessageContextImpl.getMessage(SOAPMessageContextImpl.java:78) 
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.createProtocolMessageContext(SOAPHandlerInterceptor.java:257) 
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessageInternal(SOAPHandlerInterceptor.java:161) 
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:124) 
    at org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor.handleMessage(SOAPHandlerInterceptor.java:71) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) 
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800) 
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1704) 
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1537) 
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1445) 
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) 
    at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:660) 
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) 
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) 
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366) 
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319) 
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) 
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) 

有没有办法提高客户端初始化时的响应阈值?我尝试了以下逻辑但没有用。感谢您的帮助。

  BindingProvider.getRequestContext().put("org.apache.cxf.stax.maxChildElements", -1); 

请您参考如下方法:

我遇到了类似的问题。 StaxUtils 类(至少在我使用的版本中)有一个static 方法来设置innerElementCountThreshold 的值。我在应用程序的初始化代码中添加了对 StaxUtils.setInnerElementCountThreshold(-1) 的调用,问题就消失了。


标签:Exception
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号