Uploaded image for project: 'Commons Validator'
  1. Commons Validator
  2. VALIDATOR-161

[validator] XML file included into validation.xml via entity reference not found

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Nightly Builds
    • None
    • None
    • None
    • Operating System: Windows XP
      Platform: PC

    • 27258

    Description

      I tried to put the formset constants normally defined in the validation.xml
      file into a separate file and include it via an ENTITY reference into the
      validation.xml file. The reference was declared as follows:

      <!DOCTYPE form-validation PUBLIC
      "-//Apache Software Foundation//DTD Commons Validator Rules
      Configuration 1.0//EN"
      "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd" [
      <!ENTITY formsetconstants SYSTEM "formsetconstants.xml">
      ]>

      <!-- ....... -->

      and included as follows:

      &formsetconstants;

      The included file was placed into the web-inf directory (like the
      validation.xml) of the web application which was deployed on a tomcat 4.1.24.
      As defined in the W3C XML specifications, the referenced file must be searched
      relative to the file in which it is referenced. However, the tomcat tried to
      locate the file in its "bin" directory and has thrown the following exception:

      2004-02-19 09:26:40,042 ERROR [ValidatorPlugIn.initResources: 224]
      F:\software\jakarta-tomcat-4.1.24-jb3\bin\formsetconstants.xml (The system
      cannot find the file specified)
      java.io.FileNotFoundException: F:\software\jakarta-tomcat-4.1.24-jb3
      \bin\formsetconstants.xml (The system cannot find the file specified)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:103)
      at java.io.FileInputStream.<init>(FileInputStream.java:66)
      at sun.net.www.protocol.file.FileURLConnection.connect
      (FileURLConnection.java:69)
      at sun.net.www.protocol.file.FileURLConnection.getInputStream
      (FileURLConnection.java:156)
      at java.net.URL.openStream(URL.java:960)
      at org.apache.xerces.impl.XMLEntityManager.startEntity
      (XMLEntityManager.java:807)
      at org.apache.xerces.impl.XMLEntityManager.startEntity
      (XMLEntityManager.java:738)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference
      (XMLDocumentFragmentScannerImpl.java:1095)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
      dispatch(XMLDocumentFragmentScannerImpl.java:1513)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
      (XMLDocumentFragmentScannerImpl.java:329)
      at org.apache.xerces.parsers.DTDConfiguration.parse
      (DTDConfiguration.java:525)
      at org.apache.xerces.parsers.DTDConfiguration.parse
      (DTDConfiguration.java:581)
      at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
      at org.apache.xerces.parsers.AbstractSAXParser.parse
      (AbstractSAXParser.java:1175)
      at org.apache.commons.digester.Digester.parse(Digester.java:1567)
      at org.apache.commons.validator.ValidatorResourcesInitializer.initialize
      (ValidatorResourcesInitializer.java:259)
      at org.apache.struts.validator.ValidatorPlugIn.initResources
      (ValidatorPlugIn.java:222)
      at org.apache.struts.validator.ValidatorPlugIn.init
      (ValidatorPlugIn.java:161)
      at org.apache.struts.action.ActionServlet.initModulePlugIns
      (ActionServlet.java:1158)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:486)
      at javax.servlet.GenericServlet.init(GenericServlet.java:256)

      The file is found and everything works well if I put an absolute path into the
      entity reference but I can't do that because I don't know where the tomcat
      lives on the target system.

      The same feature works well with the struts-config.xml which also uses the
      digester to read the file. I compared the validator and struts source code but
      couldn't find the problem.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--patches.zip
          3 kB
          Donald J. Brown
        2. ASF.LICENSE.NOT.GRANTED--patches.zip
          3 kB
          Donald J. Brown

        Activity

          People

            Unassigned Unassigned
            cordsmeier@gmx.de Martin Cordsmeier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: