jaxb2-maven-plugin throws Exception when maxOccurs is greater than 5000

1,551 views
Skip to first unread message

Dean Schulze

unread,
Sep 15, 2015, 7:14:02 PM9/15/15
to mojohaus-dev
When I run the jaxb2-maven-plugin on a legacy xsd it throws this Exception:

Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000

Googling this error shows that this is a limit that was put on jaxp for security purposes.  It can be disabled in code like this

SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,false);

I can't change the xsd.  How do I disable this when calling running the jaxb2-maven-plugin?


Dean Schulze

unread,
Sep 18, 2015, 11:37:35 AM9/18/15
to mojohaus-dev

Lennart Jörelid

unread,
Oct 13, 2015, 3:07:43 AM10/13/15
to mojohaus-dev
Hm.

That may be a workaround to your problem, but I find it rather un-intuitive.
As a minimum, we should document this solution in the plugin's site doc.

Jochen Wiedmann

unread,
Oct 13, 2015, 11:25:24 AM10/13/15
to mojoha...@googlegroups.com
According to [1], another possibility might be to set the system property

jdk.xml.maxOccurLimit=0

Jochen


[1] https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
> --
> You received this message because you are subscribed to the Google Groups
> "mojohaus-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mojohaus-dev...@googlegroups.com.
> To post to this group, send email to mojoha...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mojohaus-dev/2ff1053f-724c-4f4e-9cc1-b5336356ccbf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
Reply all
Reply to author
Forward
0 new messages