Details

    • Type: Bug
    • Status: Closed (View workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.6
    • Fix Version/s: 1.1.0
    • Component/s: Core
    • Labels:
      None

      Description

      Problem report

      The following correct jboss-web.xml makes cargo fail if internet is unavailable (for example, unconfigured proxy).

      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
      
      <jboss-web>
      
      
      
      <class-loading java2ClassLoadingCompliance="false">
      
      <loader-repository>
      
      ${project.build.finalName}:loader=${project.build.finalName}.war
      
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      
      </loader-repository>
      
      </class-loading>
      
      
      
      </jboss-web>
      
      

      Stacktrace is:

      [exec] Caused by: java.net.ConnectException: Connection refused: connect
      [exec] at java.net.PlainSocketImpl.socketConnect(Native Method)
      [exec] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      [exec] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      [exec] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      [exec] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      [exec] at java.net.Socket.connect(Socket.java:525)
      [exec] at java.net.Socket.connect(Socket.java:475)
      [exec] at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
      [exec] at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
      [exec] at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
      [exec] at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
      [exec] at sun.net.www.http.HttpClient.New(HttpClient.java:306)
      [exec] at sun.net.www.http.HttpClient.New(HttpClient.java:323)
      [exec] at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
      [exec] at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
      [exec] at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
      [exec] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
      [exec] at java.net.URL.openStream(URL.java:1010)
      [exec] at org.codehaus.cargo.module.XmlEntityResolver.resolveEntity(XmlEntityResolver.java:99)
      [exec] at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:1018)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1192)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
      [exec] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
      [exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
      [exec] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
      [exec] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
      [exec] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
      [exec] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      [exec] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
      [exec] at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
      [exec] at org.codehaus.cargo.module.AbstractDescriptorIo.parseXml(AbstractDescriptorIo.java:129)
      [exec] at org.codehaus.cargo.module.AbstractDescriptorIo.parseXml(AbstractDescriptorIo.java:113)
      [exec] at org.codehaus.cargo.module.webapp.jboss.JBossWebXmlIo.parseJBossWebXml(JBossWebXmlIo.java:58)
      [exec] at org.codehaus.cargo.module.webapp.jboss.JBossWarArchive.parseJBossWebXml(JBossWarArchive.java:97)
      [exec] at org.codehaus.cargo.module.webapp.jboss.JBossWarArchive.<init>(JBossWarArchive.java:61)
      [exec] at org.codehaus.cargo.container.jboss.JBossWAR.<init>(JBossWAR.java:52)
      

      Workaround

      This jboss-web.xml works:

      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 4.2//EN" "jboss-web_4_0.dtd">
      
      <jboss-web>
      
      
      
      <class-loading java2ClassLoadingCompliance="false">
      
      <loader-repository>
      
      ${project.build.finalName}:loader=${project.build.finalName}.war
      
      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
      
      </loader-repository>
      
      </class-loading>
      
      
      
      </jboss-web>
      
      

      Recommended longterm fix

      The method AbstractDescriptionIo:createDocumentBuilder(EntityResolver theEntityResolver) has a call to factory.setValidation(false);
      This is not enough. You need to:

      factory.setFeature("http://xml.org/sax/features/validation", false);
      factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
      factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
      

      Please see http://dequeue.blogspot.com/2008/12/completely-ignoring-dtd-with.html for inspiration.

      Thanks!

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                savasalitokmen Savas Ali Tokmen (Inactive)
                Reporter:
                johanferner Johan Ferner (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: