Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-5992

Cannot set org.apache.cxf.stax.maxAttributeCount

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 2.7.13, 3.0.2
    • Component/s: Documentation
    • Labels:
      None
    • Environment:

      RHEL 6.5
      Java jdk1.7.0_67 (issue also occurrs with 1.7.0_51)
      CXF 3.0.0
      Spring Framework 3.2.6.RELEASE

    • Estimated Complexity:
      Unknown

      Description

      I am setting stax properties on the cxf:bus element as follows:

      <cxf:bus>
              <cxf:properties>
                  <entry value="false">
                      <key>
                          <util:constant static-field="org.apache.cxf.ws.security.SecurityConstants.VALIDATE_TOKEN" />
                      </key>
                  </entry>
                  <entry key="org.apache.cxf.stax.maxChildElements" value="${xml.maxChildElements:50000}" />
                  <entry key="org.apache.cxf.stax.maxElementDepth" value="${xml.maxElementDepth:100}" />
                  <entry key="org.apache.cxf.stax.maxAttributeCount" value="${xml.maxAttributeCount:500}" /> 
                  <entry key="org.apache.cxf.stax.maxAttributeSize" value="${xml.maxAttributeSize:64000}" />
                  <entry key="org.apache.cxf.stax.maxTextLength" value="${xml.maxTextLength:12000000}" />
                  <entry key="org.apache.cxf.stax.maxElementCount" value="${xml.maxElementCount:9000000000000000000}" />
                  <entry key="org.apache.cxf.stax.maxXMLCharacters" value="${xml.maxXMLCharacters:9000000000000000000}" />
              </cxf:properties>
      

      Service starts up correctly. When calling any method, the following stack trace is produced:

      org.apache.cxf.interceptor.Fault: Could not create XMLStreamReader (input was of encoding UTF-8).
      	at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:136) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243) [cxf-rt-transports-http-3.0.0.jar:3.0.0]
      	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:259) [cxf-rt-transports-http-jetty-3.0.0.jar:3.0.0]
      	at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:65) [cxf-rt-transports-http-jetty-3.0.0.jar:3.0.0]
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1003) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.Server.handle(Server.java:350) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851) [jetty-http-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) [jetty-http-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) [jetty-server-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:191) [jetty-io-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606) [jetty-io-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) [jetty-io-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) [jetty-util-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) [jetty-util-8.1.3.v20120416.jar:8.1.3.v20120416]
      	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
      Caused by: javax.xml.stream.XMLStreamException: Unrecognized property 'com.ctc.wstx.maxAttributeCount'
      	at org.apache.cxf.staxutils.StaxUtils.configureReader(StaxUtils.java:1930) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.staxutils.StaxUtils.configureReader(StaxUtils.java:1855) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:134) ~[cxf-core-3.0.0.jar:3.0.0]
      	... 24 common frames omitted
      Caused by: java.lang.IllegalArgumentException: Unrecognized property 'com.ctc.wstx.maxAttributeCount'
      	at com.ctc.wstx.api.CommonConfig.reportUnknownProperty(CommonConfig.java:168) ~[woodstox-core-asl-4.3.0.jar:4.3.0]
      	at com.ctc.wstx.api.CommonConfig.setProperty(CommonConfig.java:159) ~[woodstox-core-asl-4.3.0.jar:4.3.0]
      	at com.ctc.wstx.sr.BasicStreamReader.setProperty(BasicStreamReader.java:1252) ~[woodstox-core-asl-4.3.0.jar:4.3.0]
      	at org.apache.cxf.staxutils.WoodstoxHelper.setProperty(WoodstoxHelper.java:41) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.staxutils.StaxUtils.setProperty(StaxUtils.java:1936) ~[cxf-core-3.0.0.jar:3.0.0]
      	at org.apache.cxf.staxutils.StaxUtils.configureReader(StaxUtils.java:1893) ~[cxf-core-3.0.0.jar:3.0.0]
      	... 26 common frames omitted
      

      Viewing the woodstox-core-asl-4.3.0 code http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.woodstox/woodstox-core-asl/4.4.0/com/ctc/wstx/api/WstxInputProperties.java?av=f it's evident that the correct property name to set for woodstox is "com.ctc.wstx.maxAttributesPerElement"

      If I eliminate the entry for maxAttributeCount, the error does not occur.

      The issue seems to be documentation - if I use

      <entry key="org.apache.cxf.stax.maxAttributesPerElement" value="${xml.maxAttributeCount:500}" /> 
      

      it behaves correctly.

        Attachments

          Activity

            People

            • Assignee:
              coheigea Colm O hEigeartaigh
              Reporter:
              jbavar Jennifer Bavar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: