failed to parse xml: Unrecognized property 'com.ctc.wstx.maxEntityCount'

261 views Asked by At

I'm using 'com.fasterxml.woodstox:woodstox-core:6.5.0' dependency to work with XMLInputFactory via WstxInputFactory In a gradle project. When I try to run the below code,

xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(WstxInputProperties.P_MAX_ENTITY_COUNT, 100000);

I'm getting failed to parse xml: Unrecognized property 'com.ctc.wstx.maxEntityCount'

I have included the woodstox dependency in my build.gradle(implementation 'com.fasterxml.woodstox:woodstox-core:6.5.0').

I have debugged my code and verified that xmlInputFactory instance is a WstxInputFactory instance.

I also tried excluding com.codehaus.woodstox like below to make sure this is not an issue of transitive dependency conflict since P_MAX_ENTITY_COUNT is not available in com.codehaus.woodstox versions.

configurations.implementation {
    exclude group: 'org.codehaus.woodstox', module: 'woodstox-core-asl'
}

It would be much appreciated if anyone can help with this. Thanx in advance.

1

There are 1 answers

0
StaxMan On

Since this property was added in Woodstox 4.2, I would try to double-check that there is no possibility of an older version being present in classpath during deployment: compilation succeeding with String constant getting compiled in, but WstxInputFactory coming from an older jar.