Uploaded image for project: 'Liquibase Core'
  1. CORE-3400

add "manifoldclass:" to list of skipped URL protocols in DefaultPackageScanClassResolver

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: 3.6.3
    • Fix versions: 3.6.4
    • Components: None
    • Environment:

      java application using manifold and liquibase

    • Sprint:

      Description

      Manifold is a new library plugging into the java compiler and class loader. See http://manifold.systems/ for details.

      During runtime, having the manifold jar files in the classpath, manifold itself adds an URL to the regular classloader of the form "manifoldclass://1234567890", to which DefaultPackageScanClassresolver adds the various Liquibase packages, then trying to load classes from a nonexistant jar file, resulting in a (DEBUG) stacktrace in the logfile:

      18:19:56.588 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Searching for all classes in package: liquibase/command using classloader: jdk.internal.loader.ClassLoaders$AppClassLoader
      18:19:56.590 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Getting resource URL for package: liquibase/command with classloader: jdk.internal.loader.ClassLoaders$AppClassLoader@6e5e91e4
      18:19:56.668 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - URL from classloader: jar:file:/C:/Users/grepel/.gradle/caches/modules-2/files-2.1/org.liquibase/liquibase-core/3.6.3/737c5a4fac26ee760d016923c83481ff933e4875/liquibase-core-3.6.3.jar!/liquibase/command/
      18:19:56.673 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Decoded urlPath: file:/C:/Users/grepel/.gradle/caches/modules-2/files-2.1/org.liquibase/liquibase-core/3.6.3/737c5a4fac26ee760d016923c83481ff933e4875/liquibase-core-3.6.3.jar!/liquibase/command/ with protocol: jar
      18:19:56.689 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Loading from jar using file: C:\Users\grepel\.gradle\caches\modules-2\files-2.1\org.liquibase\liquibase-core\3.6.3\737c5a4fac26ee760d016923c83481ff933e4875\liquibase-core-3.6.3.jar
      18:19:56.719 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Loaded the class: class liquibase.command.core.DropAllCommand in classloader: jdk.internal.loader.ClassLoaders$AppClassLoader@6e5e91e4
      [...]
      18:19:56.898 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - URL from classloader: manifoldclass://1851691492/liquibase/command/
      18:19:56.900 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Decoded urlPath: /liquibase/command/ with protocol: manifoldclass
      18:19:56.904 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Loading from jar using file: \liquibase\command
      18:19:56.908 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Cannot read entries in url: manifoldclass://1851691492/liquibase/command/
      java.io.FileNotFoundException: \liquibase\command (Das System kann den angegebenen Pfad nicht finden)
      	at java.base/java.io.FileInputStream.open0(Native Method)
      	at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
      	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
      	at liquibase.servicelocator.DefaultPackageScanClassResolver.findAllClasses(DefaultPackageScanClassResolver.java:227)
      	at liquibase.servicelocator.DefaultPackageScanClassResolver.find(DefaultPackageScanClassResolver.java:121)
      	at liquibase.servicelocator.DefaultPackageScanClassResolver.findImplementations(DefaultPackageScanClassResolver.java:89)
      	at liquibase.servicelocator.ServiceLocator.findClassesImpl(ServiceLocator.java:226)
      	at liquibase.servicelocator.ServiceLocator.findClasses(ServiceLocator.java:201)
      	at liquibase.database.DatabaseFactory.<init>(DatabaseFactory.java:28)
      	at liquibase.database.DatabaseFactory.getInstance(DatabaseFactory.java:46)
      	at de.scoopgmbh.kracht.zfdb.db.base.LiquibaseUpdater.doUpdate(LiquibaseUpdater.java:49)
      	at de.scoopgmbh.kracht.zfdb.db.base.BaseDBConfigDAO.start(BaseDBConfigDAO.java:26)
      	at de.scoopgmbh.kracht.zfdb.context.AppContext.lambda$start$9(AppContext.java:227)
      	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
      	at de.scoopgmbh.kracht.zfdb.context.AppContext.start(AppContext.java:224)
      	at de.scoopgmbh.kracht.zfdb.Main.main(Main.java:30)
      18:19:56.923 [main] DEBUG liquibase.servicelocator.DefaultPackageScanClassResolver - Searching for: is assignable to Database in package: liquibase/command
      
      

      While at the end it still works it is irritating to see multiple stacktraces (one per scanned package) in the log file.

      And claiming "jar" as the protocol is definitely wrong.

      DefaultPackageScanClassResolver.findAllClasses(...) already does exclude another protocol type, it skips "bundle:" URLs. Similarly, "manifest:" URLs could be skipped.

        Attachments

          Activity

            People

            • Reporter:
              ulrich.grepel Ulrich Grepel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: