Thursday 18 September 2014

Spring+Apache CXF: How to disable XML payload limits

Error: "org.apache.cxf.staxutils.DepthExceededStaxException: reach the innerElementCountThreshold:50000"
Solution: Disable XML payload limits

   <!-- disable XML payload limits -->
    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetClass" value="java.lang.System" />
        <property name="targetMethod" value="setProperty" />
        <property name="arguments">
            <list>
                <value>org.apache.cxf.stax.maxChildElements</value>
                <value>1000000</value>
            </list>
        </property>
    </bean>

PS: org.apache.cxf.interceptor.security.DepthRestrictingStreamInterceptor seem not to work

1 comment:

  1. I am using jboss eap 6.2 and a spring web mvc project.... I have put your solution in dispather-servlet.xml in web-inf directory of the spring project. But still same problem. I have tried to put the value also as SystemProperty -D.... while running jboss by standalone.sh and also have tried to put it in stanalone.xml systemproperty block... but still i m getting the same error . any clue ?

    ReplyDelete