java.lang.IllegalArgumentException: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized in JBoss EAP 7

Solution Verified - Updated -

Issue

Application is trying to create JAXP DocumentBuilder with http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit set and is failing with the error below.

      DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance();   
      dbf.setAttribute("http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit", 5);
      DocumentBuilder db = dbf.newDocumentBuilder();
java.lang.IllegalArgumentException: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
  at org.apache.xerces@2.12.0.SP03-redhat-00001//org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:144)
  at __redirected.__DocumentBuilderFactory.setAttribute(__DocumentBuilderFactory.java:125)
  at deployment.test.war//com.redhat.examples.servlet.Servlet.init(Servlet.java:38)

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.2+
  • Java JDK 11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In