Jetty
  1. Jetty
  2. JETTY-946

Redeploys with maven jetty plugin of webapps with overlays don't work

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.15
    • Fix Version/s: 6.1.16
    • Component/s: Maven
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This issue was reported by eivindo on the #jetty forum:

      <eivindjo> janb: the root cause is in ContextHandler.SContext.getResourceAsStream(String path)
      <eivindjo> if the resource is located in a jar-file (war), it then calls java.net.URL.openStream which in turn calls several methods – until java.util.zip.ZipFile.ensureOpen() throws an IllegalStateException
      <eivindjo> which in turn is catched in SontextHandler.Scontext above and null is returned.
      <eivindjo> (line 1346 in v6.1.15)
      <eivindjo> why the zip file is closed is another question, though.. :-/
      <eivindjo> it may be related to the fact that the overlaid project is added one time to the context path each time a hot deploy is performed? as the resource loader will try to load from the first file handle, that might have been closed during the restart?

      What is happening is that AbstractRunJettyMojo.java line 479 is retrieving the webapp.getBaseResource(), which will have been set on the previous deploy to contain the overlaid webapps, and then appending them
      all over again.

        Activity

        Hide
        Eivind Berg Johannessen added a comment -

        As Jan Bartel points out, the overlaid webapps is appended to the base resource collection and that should be avoided as this might cause stale file handles. However, I am not completely sure if the IllegalStateExceptions thrown by ZipFile.ensureOpen() is related to this issue, as this exception sometimes also is thrown at the initial run, i.e. before the application is redeployed. I am trying to reproduce this in an isolated environment running a minimal set of webapps – no luck so far.

        Show
        Eivind Berg Johannessen added a comment - As Jan Bartel points out, the overlaid webapps is appended to the base resource collection and that should be avoided as this might cause stale file handles . However, I am not completely sure if the IllegalStateExceptions thrown by ZipFile.ensureOpen() is related to this issue, as this exception sometimes also is thrown at the initial run, i.e. before the application is redeployed. I am trying to reproduce this in an isolated environment running a minimal set of webapps – no luck so far.
        Hide
        David Yu added a comment -

        The re-append to the ResourceCollection is now avoided when redeployed.

        Cheers

        Show
        David Yu added a comment - The re-append to the ResourceCollection is now avoided when redeployed. Cheers

          People

          • Assignee:
            David Yu
            Reporter:
            Jan Bartel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: