JSF deployment hangs in web.xml schema validation on EAP 7

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.x

Issue

  • We have a JSF deployment that hangs when starting and always times out. Thread dumps show that JSF is attempting to validate some schema for the web.xml and a resulting connection attempt is hanging:
"ServerService Thread Pool -- 128" #221 prio=5 os_prio=0 tid=0x00000000061b2800 nid=0x6ecd runnable [0x00007f0b786bf000]
   java.lang.Thread.State: RUNNABLE
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	- locked <0x00000000e7e3d048> (a java.net.SocksSocketImpl)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:607)
	at java.net.Socket.connect(Socket.java:556)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
	- locked <0x00000000e7e3cfc0> (a sun.net.www.http.HttpClient)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
	at sun.net.www.http.HttpClient.New(HttpClient.java:339)
	at sun.net.www.http.HttpClient.New(HttpClient.java:357)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
	- locked <0x00000000e7e3c560> (a sun.net.www.protocol.http.HttpURLConnection)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	- locked <0x00000000e7e3c560> (a sun.net.www.protocol.http.HttpURLConnection)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:1033)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:941)
	at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:908)
	at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:241)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:1001)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:875)
	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
	at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:298)
	at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:474)
	at org.apache.xpath.jaxp.XPathImpl.evaluate(XPathImpl.java:521)
	at com.sun.faces.util.Util.getWebXmlVersion(Util.java:1361)
	at com.sun.faces.el.ELUtils.tryAddCDIELResolver(ELUtils.java:311)
	at com.sun.faces.el.ELUtils.buildFacesResolver(ELUtils.java:242)
	at com.sun.faces.application.ApplicationAssociate.initializeELResolverChains(ApplicationAssociate.java:503)
	at com.sun.faces.application.ApplicationImpl.performOneTimeELInitialization(ApplicationImpl.java:1405)
	at com.sun.faces.application.ApplicationImpl.getELResolver(ApplicationImpl.java:529)
	at javax.faces.application.ApplicationWrapper.getELResolver(ApplicationWrapper.java:621)
	at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:256)

Resolution

  • Remove any DOCTYPE line from the web.xml, for example:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
  • Or define Servlet 4.0 schema in the web.xml instead of Servlet 2.3 DTD if the JBoss EAP version is 7.3.0 - 7.3.2:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
</web-app>
  • Update to EAP 7.3.3+

Root Cause

  • A dtd location is specified in a DOCTYPE line of the web.xml. JSF is trying to fetch and use that for validation as a result, but the location is unresponsive or unreachable from the server's internal network.
  • Even if the application does not depend on JSF APIs, it could be affected by this issue. Typically applications using Spring MVC may be affected. spring-web has an Content from github.com is not included.implementation class for javax.faces.event.PhaseListener interface. JBoss EAP's JSF subsystem scans this spring-web class in the .war and considers that the target archive should be enabled JSF during the deployment process.
  • This content is not included.JBEAP-19150
  • This content is not included.JBEAP-19161
Components
Category

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.