Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8329980

AppCDS | non-empty directory in classpath causes archive creation to fail

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Suppose my class-path is /a/b/x.jar. And my jar contains a MANIFEST.MF file having Class-Path: ../bin/
      Then during jar scanning for CDS archive creation, JVM adds /a/bin/ to the class-path. And if the directory /a/bin/ conincidentally exists and is non-empty, it causes archive creation to fail with the following error:
      Error: non-empty directory '/app/resources'

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Consider jar: 'org.openoffice:juh:4.1.2'. Add it in a nested directory, say mnt/mp/libs/juh-4.1.2.jar. This jar contains the class-path ../bin/ in its MANIFEST.MF file. Create another directory mnt/mp/bin and store any random file inside it.

      In your classpath, say CLASSPATH, include /mnt/mp/libs/juh-4.1.2.jar

      First generate class list for the project using:
      java -XX:DumpLoadedClassList=/mnt1/config/classes.lst -classpath ${CLASSPATH}

      Then try to create archive using the following command:
      java -Xshare:dump -XX:SharedClassListFile=/mnt1/config/classes.lst -XX:SharedArchiveFile=/mnt1/config/appCds.jsa -Xlog:cds=debug -Xlog:class+path=info -classpath ${CLASSPATH}

      Now, when trying to create CDS archive, will get the following error:
      Error: non-empty directory '/mnt/mp/libs/../bin/'



            ccheung Calvin Cheung
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: