title: XML Doctype validation with JBoss 7.1.1.Final AS
body: <p>While developing a <strong>J2EE</strong> application on <strong>JBoss AS 7.1.1.Final</strong>, I've been defining some configuration files as follows:</p>
  
  <p><code>xa-orchestrator-ds.xml</code> (note that my datasource is a <strong>MySQL</strong> instance):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE jboss-web PUBLIC
          "-//JBoss//DTD Web Application 5.0//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"&gt;
  &lt;datasources&gt;
  
      ...
  
  &lt;/datasources&gt;
  </code></pre>
  
  <p><code>jboss-web.xml</code>:</p>
  
  <pre><code>&lt;!DOCTYPE jboss-web PUBLIC "http://www.jboss.org/j2ee/dtd" "http://www.jboss.org/j2ee/dtd/jboss-service_5_0.dtd"&gt;
  &lt;jboss-web&gt;
  
      ...
  
  &lt;/jboss-web&gt;
  </code></pre>
  
  <p><code>web.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"&gt;
  
      ...
  
   &lt;/web-app&gt;
  </code></pre>
  
  <p>This configuration causes a runtime exception related to XML validation:</p>
  
  <pre><code>12:28:50,676 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."MIUR_PRISMA-2.1-BusinessLayer.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."MIUR_PRISMA-2.1-BusinessLayer.war".PARSE: Failed to process phase PARSE of deployment "MIUR_PRISMA-2.1-BusinessLayer.war"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
  Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Connection reset
      at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:85)
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
      ... 5 more
  Caused by: com.ctc.wstx.exc.WstxIOException: Connection reset
      at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:699)
      at com.ctc.wstx.sr.ValidatingStreamReader.findDtdExtSubset(ValidatingStreamReader.java:480)
      at com.ctc.wstx.sr.ValidatingStreamReader.finishDTD(ValidatingStreamReader.java:341)
      at com.ctc.wstx.sr.BasicStreamReader.skipToken(BasicStreamReader.java:3341)
      at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1958)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1102)
      at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1125)
      at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:106)
      at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:82)
      at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:80)
      ... 6 more
  Caused by: java.net.SocketException: Connection reset
      at java.net.SocketInputStream.read(SocketInputStream.java:196) [rt.jar:1.7.0_51]
      at java.net.SocketInputStream.read(SocketInputStream.java:122) [rt.jar:1.7.0_51]
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) [rt.jar:1.7.0_51]
      at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) [rt.jar:1.7.0_51]
      at java.io.BufferedInputStream.read(BufferedInputStream.java:334) [rt.jar:1.7.0_51]
      at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687) [rt.jar:1.7.0_51]
      at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633) [rt.jar:1.7.0_51]
      at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:658) [rt.jar:1.7.0_51]
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323) [rt.jar:1.7.0_51]
      at java.net.URL.openStream(URL.java:1037) [rt.jar:1.7.0_51]
      at com.ctc.wstx.util.URLUtil.inputStreamFromURL(URLUtil.java:146)
      at com.ctc.wstx.io.DefaultInputResolver.sourceFromURL(DefaultInputResolver.java:254)
      at com.ctc.wstx.io.DefaultInputResolver.resolveEntity(DefaultInputResolver.java:92)
      at com.ctc.wstx.sr.ValidatingStreamReader.findDtdExtSubset(ValidatingStreamReader.java:471)
      ... 14 more
  </code></pre>
  
  <p>Indeed, by removing the doctype definition from <code>xa-orchestrator-ds.xml</code>, it works fine.</p>
  
  <p>Which is the properly configuration by including right doctypes?</p>