JBoss EAP customers may be affected by Oracle’s http redirect if using CDI/Weld applications with beans.xml referencing xsd schema on Oracle’s site

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6

Issue

  • JBoss EAP customers may be affected by Oracle’s http redirect if using CDI/Weld applications with beans.xml referencing xsd schema on Oracle’s site
  • SAXParseException; Premature end of file ... DeploymentUnitProcessingException: SAXException parsing ... beans.xml in JBoss EAP 6
  • Application fails to deploy in EAP 6 because of app.ear/web.war/WEB-INF/classes/META-INF/beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
   bean-discovery-mode="all">
</beans>
  • The error is :
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."app.ear"."web.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."app.ear"."web.war".PARSE: JBAS018733: Failed to process phase PARSE of subdeployment "web.war" of deployment "app.ear"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:184) [jboss-as-server-7.5.18.Final-redhat-1.jar:7.5.18.Final-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2064) [jboss-msc-1.1.7.SP1-redhat-1.jar:1.1.7.SP1-redhat-1]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1987) [jboss-msc-1.1.7.SP1-redhat-1.jar:1.1.7.SP1-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_212]
        at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_212]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: SAXException parsing vfs:/content/app.ear/web.war/WEB-INF/classes/META-INF/beans.xml
        at org.jboss.as.weld.deployment.BeansXmlParser.parse(BeansXmlParser.java:101)
        at org.jboss.as.weld.deployment.processors.BeansXmlProcessor.parseBeansXml(BeansXmlProcessor.java:139)
        at org.jboss.as.weld.deployment.processors.BeansXmlProcessor.deploy(BeansXmlProcessor.java:110)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:177) [jboss-as-server-7.5.18.Final-redhat-1.jar:7.5.18.Final-redhat-1]
        ... 5 more
Caused by: org.xml.sax.SAXParseException; Premature end of file.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:175)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:322)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:281)
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:203)
        at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:551)
        at org.apache.xerces.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:654)
        at org.apache.xerces.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:523)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:1800)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:521)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:554)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2526)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1813)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:724)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
        at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(SAXParserImpl.java:289)
        at org.jboss.as.weld.deployment.BeansXmlParser.parse(BeansXmlParser.java:95)
        ... 8 more

Resolution

As of June 27, 2019, Oracle has changed the redirect and the issue is no longer occurring.


You can request a one off patch by opening a support case, which will allow you to set -Dorg.jboss.weld.xml.disableValidating=true to disable beans.xml validation to workaround the issue.

Workarounds:

  • If you are not configuring anything in the beans.xml, you can just remove the contents of the beans.xml and leave an empty beans.xml file which will activate CDI for the application.

  • Change the beans.xml to:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/beans_1_1.xsd"
   bean-discovery-mode="all">
</beans>
  • Also, typically the beans.xml goes in a war's WEB-INF/ instead of WEB-INF/classes/META-INF. And if there is not any configuration in beans.xml, an empty beans.xml can be used with no content, which will activate CDI for the sub deployment.
  • Note this does not impact beans.xml parsing on EAP 7.

Root Cause

  • Oracle is redirecting http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/beans_1_1.xsd. The validator fails trying to parse an empty redirect response instead of fetching the file from the new redirect location.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

3 Comments

Issue is resolved for me .

Thanks

If we cant change that file right now, is there a work around?

We encountered the issue June 25th. Then the issue went away today (June 27th)