Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-4694

Using component scanning in signed jars is very slow

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.5.1, 2.5.2, 2.5.3
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
    • Last commented by a User:
      false

      Description

      Since upgrading from Spring 2.0.8 to Spring 2.5.3 our application that runs in signed jars (as required by webstart) starts VERY slowly. It runs fine in a signed jar with Spring 2.0.8 but since the upgrade now takes 5 or more minutes to start as opposed to 10-15 seconds under Spring 2.0.8.

      What's interesting is that it's equally fast with Spring 2.5.3 as long as the jar is unsigned. However, as soon as you sign the jar and then run the application (via java -cp ourfile.jar mainclass) it takes forever to start. Downgrading back to Spring 2.0.8 also solves the issue. Getting stack dumps show that it seems like as of Spring 2.5.x (we tried 2.5.1-2.5.3) during startup on a signed jar is now spending a tremendous amount of time doing jar verification triggered from org.springframework.core.io.UrlResource. Here are a couple sample stack dumps of what the application is doing during the now very long startup period:

      ....
      at java.util.jar.JarFile.getManifestFromReference(JarFile.java:159)
      at java.util.jar.JarFile.getManifest(JarFile.java:146)
      at sun.net.www.protocol.jar.URLJarFile.isSuperMan(URLJarFile.java:155)

      • locked <0x8c031f88> (a sun.net.www.protocol.jar.URLJarFile)
        at sun.net.www.protocol.jar.URLJarFile.getManifest(URLJarFile.java:121)
        at java.util.jar.JarFile.maybeInstantiateVerifier(JarFile.java:287)
        at java.util.jar.JarFile.getInputStream(JarFile.java:381)
      • locked <0x8c031f88> (a sun.net.www.protocol.jar.URLJarFile)
        at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:144)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:123)
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:74)

      or here

      ....
      at java.util.jar.JarVerifier.processEntry(JarVerifier.java:250)

      • locked <0x8d9c05a0> (a [B)
        at java.util.jar.JarVerifier.update(JarVerifier.java:188)
        at java.util.jar.JarFile.initializeVerifier(JarFile.java:321)
        at java.util.jar.JarFile.getInputStream(JarFile.java:386)
      • locked <0x8dc380e8> (a sun.net.www.protocol.jar.URLJarFile)
        at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:144)
        at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:123)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                thuss Todd Huss
                Last updater:
                Juergen Hoeller
              • Votes:
                13 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  18 weeks, 6 days ago