Uploaded image for project: 'Cactus'
  1. Cactus
  2. CACTUS-45

CactifyWarTask duplicates init-param lines in existing web.xml sevlet tag

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Ant Integration
    • None
    • Operating System: Linux
      Platform: PC
    • 21237

    Description

      When running cactifywar against an existing web.xml file that contains
      a <servlet> tag it appears as if the CactifyWar task is duplicating all of the
      <init-param> tags within that servlet tag.

      This becomes a big problem when there are other elements that belong after the
      <init-params> tag (such as a <load-on-startup> tag, in my instance), because it
      causes the WAR deployment to fail because of the invalid <Servlet> in the web.xml.

      This means that the <cactus> tag then just hangs there waiting to use a servlet
      on a WAR file that hasn't deployed.

      the original servlet line from my web.xml:
      <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <init-param>
      <param-name>application</param-name>
      <param-value>net.trusecure.tes.servlet.ApplicationResources</param-value>
      </init-param>
      <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param>
      <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
      </init-param>
      <load-on-startup>2</load-on-startup>
      </servlet>

      'cactified' version:
      <servlet> <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <init-param> <param-name>application</param-name>
      <param-value>net.trusecure.tes.servlet.ApplicationResources</param-value>
      </init-param> <init-param> <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
      </init-param> <init-param> <param-name>debug</param-name>
      <param-value>2</param-value> </init-param>
      <load-on-startup>2</load-on-startup>
      <init-param><param-name>application</param-name><param-value>net.trusecure.tes.servlet.ApplicationResources</param-value></init-param><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>2</param-value></init-param></servlet>

      Notice that the init-params are duplicated. They are also jammed back into the
      servlet AFTER the load-on-startup tag. The duplication does not appear to be
      related to the <load-on-startup> tag (I have tried without the load-on-startup
      tag, and the params are still duplicated).

      So, it's most likely that someone accidentally re-used a variable or something.

      thanks.

      btw, It wouldn't hurt to throw some new-lines into the cactified web.xml file
      to make it more readable.

      Attachments

        Activity

          People

            Unassigned Unassigned
            anilm2@yahoo.com Anil Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: