Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2364

A DTD defined in an XML file requires an Internet connection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 1.2.4
    • None
    • Tiles 1 Plugin
    • None
    • Operating System: Windows XP
      Platform: PC
    • 33570

    Description

      When I use the Tiles plug-in in Struts, if a configuration XML file contains an
      external URL for a DTD specification, the Web application does not load properly
      if an Internet connection is not present. This problem does not occur with
      Struts 1.1.

      For example, the following excerpt from my Struts configuration file:

      <plug-in className="org.apache.struts.tiles.TilesPlugin" >
      <set-property
      property="definitions-config"
      value="/WEB-INF/config/generic-tiles-defs.xml,
      /WEB-INF/config/base-tiles-defs.xml,
      /WEB-INF/config/tiles-defs.xml" />
      <set-property
      property="moduleAware"
      value="true" />
      </plug-in>

      refers to the generic-tiles-defs.xml, which begins as follows:

      <?xml version="1.0" encoding="ISO-8859-1" ?>

      <!DOCTYPE tiles-definitions PUBLIC
      "-//Apache Software Foundation//DTD Tiles Configuration//EN"
      "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

      If no Internet connection is present, an UnknownHostException is thrown when
      Digester tries to open the URLConnection associated to the above URL.

      Maybe this exception occurred in previous versions of Struts, but now it is not
      managed properly anymore. As a result, this error prevents the Web application
      from loading and working correctly.

      The exception stack trace begins as follows:

      javax.servlet.ServletException: IO Error while parsing file
      '/WEB-INF/config/generic-tiles-defs.xml'. jakarta.apache.org
      at org.apache.struts.tiles.TilesPlugin.initDefinitionsFactory(TilesPlugin.java:235)
      at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:139)
      at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:839)
      at org.apache.struts.action.ActionServlet.init(ActionServlet.java:332)
      at
      ca.ulaval.fsa.drdb.dbfw.webapp.controller.struts.DbActionServlet.init(DbActionServlet.java:18)
      [...]

      The IO error message comes from the parseXmlFile method of the
      org.apache.struts.tiles.xmlDefinition.I18nFactorySet. The exception is thrown by
      the xmlParser.parse(input, xmlDefinitions) method call at the end of the try clause.

      The related libraries I use are Commons BeanUtils 1.7.0, Collections 3.1,
      Digester 1.6, Logging 1.0.4. As mentioned above, if I use Struts 1.1 (and
      deactivate my Struts 1.2-specific code) without changing any other libraries,
      everything works properly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jfmorin@mail.com Jean-François Morin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: