Commons Digester
  1. Commons Digester
  2. DIGESTER-29

[digester] Loading of resources causes webapp to fail redeploy under Tomcat 5.5.x

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.8
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      This was originally filed against Beehive as
      http://issues.apache.org/jira/browse/BEEHIVE-960 , but I've narrowed it down to
      either a Digester issue or a Tomcat issue. Tomcat seems to suggest that this is
      an issue related to getting resources out of a JAR:

      Specifically, Tomcat turned off the behavior that prevents locking of JARs under
      Windows. They did this to improve startup time. I don't necessarily agree with
      this choice as a default, but if you believe their bug comments and FAQ, this
      actually just exposes Windows-specific bugs in the way resources are read out of
      JARs.

      To reproduce this:

      • Run 'ant build war' in the attached directory.
      • Copy strutsRedeploy.war into $CATALINA_HOME/webapps.
      • Verify that there is a fully-extracted webapp under
        $CATALINA_HOME/webapps/strutsRedeploy.
      • Copy strutsRedeploy.war (again) into $CATALINA_HOME/webapps.

      Now look in $CATALINA_HOME/webapps/strutsRedeploy – it failed to redeploy, and
      the only file left in there is WEB-INF/lib/struts.jar.

      I'm attaching a Digester patch that fixes the issue.

      Note: the fix for this issue belongs in one of three places:

      • Tomcat (which has rejected working around it since it impacts startup time)
      • Digester
      • XML support in the JDK

      Hopefully you'll choose Digester.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        482d 17h 28m 1 Simon Kitching 07/Feb/07 02:35
        Simon Kitching made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.8 Final [ 12312178 ]
        Hide
        Simon Kitching added a comment -

        Fixed in 1.8 release.

        Show
        Simon Kitching added a comment - Fixed in 1.8 release.
        Hide
        Simon Kitching added a comment -

        Hi Craig, welcome back. There is currently work going on to prepare Digester for a 1.8 release; finishing maven2 support is the major TODO. Hopefully a release can be made in the next couple of weeks.

        There is a recent email thread in the dev archives talking about release stuff.

        Of course all help is welcome!

        Show
        Simon Kitching added a comment - Hi Craig, welcome back. There is currently work going on to prepare Digester for a 1.8 release; finishing maven2 support is the major TODO. Hopefully a release can be made in the next couple of weeks. There is a recent email thread in the dev archives talking about release stuff. Of course all help is welcome!
        Hide
        Craig McClanahan added a comment -

        Besides 1.5 (the documented "Affected Version"), this issue is also present in version 1.6 and 1.7. It bit me when I was using the Digester.register() method to register copies of DTDs internal to the JAR file. This would cause an I/O stream or something to remain open on the DTD, which (in turn) would cause the jar file to remain locked after a webapp undeploy on Windows.

        Happily, the patched version works fine for this scenario (tested with the 20061111 nightly build), so I guess it's time to get back in the digester game and help get a 1.8 release out the door .

        Show
        Craig McClanahan added a comment - Besides 1.5 (the documented "Affected Version"), this issue is also present in version 1.6 and 1.7. It bit me when I was using the Digester.register() method to register copies of DTDs internal to the JAR file. This would cause an I/O stream or something to remain open on the DTD, which (in turn) would cause the jar file to remain locked after a webapp undeploy on Windows. Happily, the patched version works fine for this scenario (tested with the 20061111 nightly build), so I guess it's time to get back in the digester game and help get a 1.8 release out the door .
        Henri Yandell made changes -
        Affects Version/s 1.5 Final [ 12311691 ]
        Henri Yandell made changes -
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Affects Version/s 1.5 Final [ 12311664 ]
        Component/s Digester [ 12311111 ]
        Project Commons [ 12310458 ] Commons Digester [ 12310471 ]
        Key COM-2470 DIGESTER-29
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 37034 12342622
        Hide
        Rich Feit added a comment -

        Thank you. FYI, I verified that your modified patch fixes the specific problem
        I reported.

        Show
        Rich Feit added a comment - Thank you. FYI, I verified that your modified patch fixes the specific problem I reported.
        Hide
        Simon Kitching added a comment -

        I've applied a slightly modified version of this patch. See r325861, r325866.

        I'd like to leave this open as I think the xmlrules module probably has a few
        places where this same change needs to be made.

        Show
        Simon Kitching added a comment - I've applied a slightly modified version of this patch. See r325861, r325866. I'd like to leave this open as I think the xmlrules module probably has a few places where this same change needs to be made.
        Hide
        Rich Feit added a comment -

        Thanks for the fast response, Simon. I'll verify that fixing the lack of
        systemId doesn't break my test case (I doubt it).

        Show
        Rich Feit added a comment - Thanks for the fast response, Simon. I'll verify that fixing the lack of systemId doesn't break my test case (I doubt it).
        Hide
        Simon Kitching added a comment -

        Thanks very much for your patch, Rich.

        I've got no objection to this change in principle. Clearly the correct place to
        fix it is in the JDK's implementation of InputSource, but this wouldn't be the
        first workaround for a JDK bug in Digester.

        There is a potential issue with the provided patch, which is that the
        InputSource is created with no knowledge of the systemId (just a Stream) which
        means that relative paths within the resource won't work any longer. I think
        that can be fixed by just doing:

        InputSource is = new InputSource(urlConnection.getInputStream());
        is.setSystemId(entityURL);
        return is;

        And there should also be a comment in the code explaining why this simple task
        is being implemented in this odd manner.

        I don't have much time to analyse this patch properly just at the moment; I'll
        try to do so at the weekend if someone else doesn't commit this before then.

        Show
        Simon Kitching added a comment - Thanks very much for your patch, Rich. I've got no objection to this change in principle. Clearly the correct place to fix it is in the JDK's implementation of InputSource, but this wouldn't be the first workaround for a JDK bug in Digester. There is a potential issue with the provided patch, which is that the InputSource is created with no knowledge of the systemId (just a Stream) which means that relative paths within the resource won't work any longer. I think that can be fixed by just doing: InputSource is = new InputSource(urlConnection.getInputStream()); is.setSystemId(entityURL); return is; And there should also be a comment in the code explaining why this simple task is being implemented in this odd manner. I don't have much time to analyse this patch properly just at the moment; I'll try to do so at the weekend if someone else doesn't commit this before then.
        Hide
        Rich Feit added a comment -

        Created an attachment (id=16670)
        Proposed fix

        This seems to fix the problem.

        Show
        Rich Feit added a comment - Created an attachment (id=16670) Proposed fix This seems to fix the problem.
        Hide
        Rich Feit added a comment -

        Created an attachment (id=16669)
        Repro case

        I had to remove a few JARs from WEB-INF/lib for the attachment to be accepted
        – I ran it again and it still seems to work.

        Show
        Rich Feit added a comment - Created an attachment (id=16669) Repro case I had to remove a few JARs from WEB-INF/lib for the attachment to be accepted – I ran it again and it still seems to work.
        Rich Feit created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Rich Feit
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development