Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native image with liquibase on Windows 11 #33030

Closed
mperiathambi opened this issue May 1, 2023 · 13 comments · Fixed by #36223
Closed

Native image with liquibase on Windows 11 #33030

mperiathambi opened this issue May 1, 2023 · 13 comments · Fixed by #36223
Labels
area/liquibase env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@mperiathambi
Copy link

mperiathambi commented May 1, 2023

Describe the bug

Error: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
Detailed message:
Trace: Object was reached by
  reading field java.util.Collections$UnmodifiableMap.m of constant
    java.util.Collections$UnmodifiableMap@3d6b5e53: {USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=true, NVM_SYMLINK=C:\Users\manoj\s...
  reading field liquibase.configuration.core.EnvironmentValueProvider.environment of constant
    liquibase.configuration.core.EnvironmentValueProvider@2e550043: liquibase.configuration.core.EnvironmentValueProvider@2e550043
  reading field java.util.TreeMap$Entry.key of constant
    java.util.TreeMap$Entry@ad6079d: liquibase.configuration.core.EnvironmentValueProvider@2e550043=java.lang.Object@...
  reading field java.util.TreeMap$Entry.left of constant
    java.util.TreeMap$Entry@39b9cd85: liquibase.configuration.core.SystemPropertyValueProvider@49a0b563=java.lang.Obje...
  reading field java.util.TreeMap$Entry.left of constant
    java.util.TreeMap$Entry@3a34b2ff: liquibase.configuration.core.DeprecatedConfigurationValueProvider@1e9d4e0=java.l...
  reading field java.util.TreeMap.root of constant
    java.util.TreeMap@69e227b8: {liquibase.configuration.core.EnvironmentValueProvider@2e550043=java.lang.Object...
  reading field java.util.TreeSet.m of constant
    java.util.TreeSet@4e0a2e90: [liquibase.configuration.core.EnvironmentValueProvider@2e550043, liquibase.confi...
  reading field liquibase.configuration.LiquibaseConfiguration.configurationValueProviders of constant
    liquibase.configuration.LiquibaseConfiguration@69d0a1bc: liquibase.configuration.LiquibaseConfiguration@69d0a1bc
  reading field java.util.TreeMap$Entry.value of constant
    java.util.TreeMap$Entry@2d3d3cbb: liquibase.configuration.LiquibaseConfiguration=liquibase.configuration.Liquibase...
  reading field java.util.TreeMap$Entry.left of constant
    java.util.TreeMap$Entry@56a3580a: liquibase.logging.core.LogServiceFactory=liquibase.logging.core.LogServiceFactor...
  reading field java.util.TreeMap$Entry.left of constant
    java.util.TreeMap$Entry@2fb65450: resourceAccessor=ClassLoaderResourceAccessor{}
  reading field java.util.TreeMap.root of constant
    java.util.TreeMap@e1d25f1: {liquibase.configuration.ConfiguredValueModifierFactory=liquibase.configuration....
  reading field liquibase.util.SmartMap.values of constant
    liquibase.util.SmartMap@5442070e: liquibase.util.SmartMap@344d60ad

Expected behavior

Native image should be produced.

Actual behavior

No response

How to Reproduce?

https://github.com/quarkusio/quarkus-quickstarts/tree/main/liquibase-quickstart

Output of uname -a or ver

Microsoft Windows [Version 10.0.22621.1555]

Output of java -version

openjdk version "11.0.17" 2022-10-18 LTS OpenJDK Runtime Environment Zulu11.60+19-CA (build 11.0.17+8-LTS) OpenJDK 64-Bit Server VM Zulu11.60+19-CA (build 11.0.17+8-LTS, mixed mode)

GraalVM version (if different from Java)

openjdk version "11.0.19" 2023-04-18 OpenJDK Runtime Environment GraalVM CE 22.3.2 (build 11.0.19+7-jvmci-22.3-b18) OpenJDK 64-Bit Server VM GraalVM CE 22.3.2 (build 11.0.19+7-jvmci-22.3-b18, mixed mode, sharing)

Quarkus version or git rev

3.0.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6
Java version: 11.0.17, vendor: Azul Systems, Inc., runtime: C:\Users\manoj.sdkman\candidates\java\11.0.17.fx-zulu Default locale: en_IE, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

@mperiathambi mperiathambi added the kind/bug Something isn't working label May 1, 2023
@quarkus-bot quarkus-bot bot added area/liquibase env/windows Impacts Windows machines labels May 1, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented May 1, 2023

/cc @andrejpetras (liquibase), @geoand (liquibase), @gsmet (liquibase)

@melloware
Copy link
Contributor

I just built my project which uses Liquibase on Windows using 3.0.1 and its all working fine. See my project here: https://github.com/melloware/quarkus-monorepo

@mperiathambi
Copy link
Author

Have you tried the repo which is the sample provided from quarkus I provided ?

Is it because java 11..?
is it because GraalVm?
or I have installed MS Tools in my computer and building the code. I'm not using docket.

I haven't have any success with your repo yet.

@melloware
Copy link
Contributor

Ahhh possibly I am using Docker and Mandrel.

@melloware
Copy link
Contributor

OK just tried that QuickStart with Docker/Mandrel and it builds a native image just fine.

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\temp\liquibase-quickstart\target\liquibase-quickstart-1.0.0-SNAPSHOT-native-image-source-jar\liquibase-quickstart-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Using docker.exe to run the native image builder
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Checking image status quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
22.3-java17: Pulling from quarkus/ubi-quarkus-mandrel-builder-image
Digest: sha256:58bb72ce64a07331e26ee9b8a90f45eb89788a63fb996248002ed8a4c93b1951
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on native-image 22.3.2.1-Final Mandrel Distribution (Java Version 17.0.7+7)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker.exe run --env LANG=C --rm -v /c/temp/liquibase-quickstart/target/liquibase-quickstart-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --name build-native-lHWlu quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Dlogging.initial-configurator.min-level=500 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 --features=io.quarkus.jdbc.h2.runtime.H2Reflections,io.quarkus.runner.Feature,io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature,io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature,io.quarkus.runtime.graal.DisableLoggingFeature,org.hibernate.graalvm.internal.GraalVMStaticFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+CollectImageBuildStatistics -H:ImageBuildStatisticsFile=liquibase-quickstart-1.0.0-SNAPSHOT-runner-timing-stats.json -H:BuildOutputJSONFile=liquibase-quickstart-1.0.0-SNAPSHOT-runner-build-output-stats.json -H:+AllowFoldMethods -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+ReportExceptionStackTraces -H:-AddAllCharsets --enable-url-protocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED --add-modules=jdk.net --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json liquibase-quickstart-1.0.0-SNAPSHOT-runner -jar liquibase-quickstart-1.0.0-SNAPSHOT-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'liquibase-quickstart-1.0.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                   (30.0s @ 0.59GB)
 Version info: 'GraalVM 22.3.2.1-Final Java 17 Mandrel Distribution'
 Java version info: '17.0.7+7'
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC
 7 user-specific feature(s)
 - io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature
 - io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - io.quarkus.jdbc.h2.runtime.H2Reflections: Support for H2 Database's extended data types
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
 - org.hibernate.graalvm.internal.GraalVMStaticFeature: Hibernate ORM's static reflection registrations for GraalVM
[2/7] Performing analysis...  [*******]                                                                 (28.4s @ 3.84GB)
  17,480 (87.80%) of 19,910 classes reachable
  27,889 (63.85%) of 43,677 fields reachable
  92,501 (57.44%) of 161,033 methods reachable
   1,092 classes,   588 fields, and 7,277 methods registered for reflection
      64 classes,    70 fields, and    55 methods registered for JNI access
       4 native libraries: dl, pthread, rt, z
[3/7] Building universe...                                                                               (4.2s @ 4.24GB)
[4/7] Parsing methods...      [**]                                                                       (3.7s @ 2.90GB)
[5/7] Inlining methods...     [****]                                                                     (1.2s @ 2.64GB)
[6/7] Compiling methods...    [****]                                                                    (15.9s @ 4.18GB)
[7/7] Creating image...                                                                                  (6.0s @ 4.03GB)
  37.85MB (49.80%) for code area:    59,670 compilation units
  37.79MB (49.73%) for image heap:  409,693 objects and 192 resources
 362.84KB ( 0.47%) for other data
  76.00MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
   1.64MB sun.security.ssl                                     8.51MB byte[] for code metadata
   1.11MB java.util                                            4.28MB java.lang.Class
 765.68KB java.lang.invoke                                     3.87MB java.lang.String
 722.18KB com.sun.crypto.provider                              3.34MB byte[] for general heap data
 589.96KB org.h2.table                                         3.24MB byte[] for java.lang.String
 568.24KB org.h2.command                                       2.49MB byte[] for embedded resources
 560.09KB liquibase.sqlgenerator.core                          1.47MB com.oracle.svm.core.hub.DynamicHubCompanion
 534.38KB java.lang                                            1.17MB byte[] for reflection metadata
 499.64KB io.quarkus.runtime.generated                       796.74KB java.lang.String[]
 484.16KB com.sun.org.apache.xerces.internal.impl            740.39KB java.util.HashMap$Node
  30.04MB for 756 more packages                                7.05MB for 3749 more object types
------------------------------------------------------------------------------------------------------------------------
                        3.5s (3.5% of total time) in 52 GCs | Peak RSS: 6.50GB | CPU load: 8.60
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /project/liquibase-quickstart-1.0.0-SNAPSHOT-runner (executable)
 /project/liquibase-quickstart-1.0.0-SNAPSHOT-runner-build-output-stats.json (json)
 /project/liquibase-quickstart-1.0.0-SNAPSHOT-runner-timing-stats.json (raw)
 /project/liquibase-quickstart-1.0.0-SNAPSHOT-runner.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'liquibase-quickstart-1.0.0-SNAPSHOT-runner' in 1m 35s.
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker.exe run --env LANG=C --rm -v /c/temp/liquibase-quickstart/target/liquibase-quickstart-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --entrypoint /bin/bash quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 -c objcopy --strip-debug liquibase-quickstart-1.0.0-SNAPSHOT-runner
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 125254ms

@gsmet
Copy link
Member

gsmet commented May 2, 2023

@melloware if you use Docker, you're building on Linux. The issue might be specific to Windows given it's about low level JDK classes.
I remember having seen similar issues before.

@Willian199
Copy link

I'm using Windows 10 and I get the same error, when I tried to build a native image with quickstart repository.

Additional info:
Windows 10 21H2 (19044.3086)
AMD Processor
GraalVM 17.0.7+8.1

@barais
Copy link

barais commented Jul 10, 2023

I confirm the bug (same behavior on two environments).
Within the github action for GraalVM. trace is here. (https://github.com/correctexam/corrigeExamBack/actions/runs/5509257503/jobs/10041885988)
I can reproduce it on graalvm-ce-java17-windows-amd64-22.3.2 on a windows VM

Seems to be reproduce in doing on a windows machine

git clone https://github.com/correctexam/corrigeExamBack.git
cd corrigeExamBack
mvnw -P"native,alone" clean package -DskipTests

If it could help, it works well if I remove the following dependency. (No problem on mac and linux with this dependency)

  <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-liquibase</artifactId>
    </dependency>

Seems to be closed to this bug that seems to have been fixed but it could be seen as a regression.

@vincejv
Copy link

vincejv commented Sep 2, 2023

I can easily reproduce this issue on Quarkus 3.3.1 using the starter code generated from https://code.quarkus.io/

Almost the same issue with @barais, but the dependency used is liquibase-mongodb, removing the said dependency fixes the issue.

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-liquibase-mongodb</artifactId>
</dependency>

No issues so far when compiling with linux x64 native, seems like isolated to windows x64 native builds. I also agree that this might be related to the same bug raised in this issue #22449, so not sure if the fix was only applied on Quarkus v2 and not ported to v3

Sample project: https://github.com/vincejv/playground/tree/89919bc9b96dbdb8faf1a21725c0574989e9fcd7
GitHub actions log: https://github.com/vincejv/playground/actions/runs/6055879206/job/16435301791

[2/8] Performing analysis...  [*****]                                                                  (153.0s @ 2.01GB)
  18,014 (89.07%) of 20,225 types reachable
  28,621 (64.07%) of 44,670 fields reachable
 104,923 (62.26%) of 168,525 methods reachable
Error: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
   5,887 types,   610 fields, and 8,746 methods registered for reflection
Detailed message:
Trace: Object was reached by
  reading field java.util.Collections$UnmodifiableMap.m of constant 
    java.util.Collections$UnmodifiableMap@60f1a9d7: {Path=C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\graalvm-jdk-17_wi...
  reading field liquibase.configuration.core.EnvironmentValueProvider.environment of constant 
    liquibase.configuration.core.EnvironmentValueProvider@2c4d2364: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364
  reading field java.util.TreeMap$Entry.key of constant 
    java.util.TreeMap$Entry@36b5cd86: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object@...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@62dcca70: liquibase.configuration.core.SystemPropertyValueProvider@379dad63=java.lang.Obje...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@27d6813e: liquibase.configuration.core.DeprecatedConfigurationValueProvider@5a0c0a0b=java....
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@1[2608](https://github.com/vincejv/playground/actions/runs/6055879206/job/16435301791#step:6:2609)c14: {liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object...
  reading field java.util.TreeSet.m of constant 
    java.util.TreeSet@5f8bb24e: [liquibase.configuration.core.EnvironmentValueProvider@2c4d2364, liquibase.confi...
  reading field liquibase.configuration.LiquibaseConfiguration.configurationValueProviders of constant 
    liquibase.configuration.LiquibaseConfiguration@3a8460d1: liquibase.configuration.LiquibaseConfiguration@3a8460d1
  reading field java.util.TreeMap$Entry.value of constant 
    java.util.TreeMap$Entry@715260d8: liquibase.configuration.LiquibaseConfiguration=liquibase.configuration.Liquibase...
  reading field java.util.TreeMap$Entry.right of constant 
    java.util.TreeMap$Entry@2dac1aff: liquibase.configuration.ConfiguredValueModifierFactory=liquibase.configuration.C...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2e2fca61: liquibase.logging.core.LogServiceFactory=liquibase.logging.core.LogServiceFactor...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2b1e4cbb: resourceAccessor=ClassLoaderResourceAccessor{}
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@38058acd: {liquibase.command.CommandFactory=liquibase.command.CommandFactory@67ca15fc, liq...
  reading field liquibase.util.SmartMap.values of constant 
    liquibase.util.SmartMap@6b9e54d8: liquibase.util.SmartMap@aad08fb6
  reading field liquibase.Scope.values of constant 
    liquibase.Scope@139984e7: scope(database=null)
  reading field liquibase.SingletonScopeManager.currentScope of constant 
    liquibase.SingletonScopeManager@2055a5cd: liquibase.SingletonScopeManager@2055a5cd
  reading static field liquibase.Scope.scopeManager
    at liquibase.Scope.getCurrentScope(Scope.java:76)
  parsing method liquibase.Scope.getCurrentScope(Scope.java:76) reachable via the parsing context
    at liquibase.plugin.AbstractPluginFactory.getPlugin(AbstractPluginFactory.java:41)
    at liquibase.license.LicenseServiceFactory.getLicenseService(LicenseServiceFactory.java:21)
    at root method.(Unknown Source)


com.oracle.svm.core.util.UserError$UserException: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
Detailed message:
Trace: Object was reached by
  reading field java.util.Collections$UnmodifiableMap.m of constant 
    java.util.Collections$UnmodifiableMap@60f1a9d7: {Path=C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\graalvm-jdk-17_wi...
  reading field liquibase.configuration.core.EnvironmentValueProvider.environment of constant 
    liquibase.configuration.core.EnvironmentValueProvider@2c4d2364: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364
  reading field java.util.TreeMap$Entry.key of constant 
    java.util.TreeMap$Entry@36b5cd86: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object@...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@62dcca70: liquibase.configuration.core.SystemPropertyValueProvider@379dad63=java.lang.Obje...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@27d6813e: liquibase.configuration.core.DeprecatedConfigurationValueProvider@5a0c0a0b=java....
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@12608c14: {liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object...
  reading field java.util.TreeSet.m of constant 
    java.util.TreeSet@5f8bb24e: [liquibase.configuration.core.EnvironmentValueProvider@2c4d2364, liquibase.confi...
  reading field liquibase.configuration.LiquibaseConfiguration.configurationValueProviders of constant 
    liquibase.configuration.LiquibaseConfiguration@3a8460d1: liquibase.configuration.LiquibaseConfiguration@3a8460d1
  reading field java.util.TreeMap$Entry.value of constant 
    java.util.TreeMap$Entry@715260d8: liquibase.configuration.LiquibaseConfiguration=liquibase.configuration.Liquibase...
  reading field java.util.TreeMap$Entry.right of constant 
    java.util.TreeMap$Entry@2dac1aff: liquibase.configuration.ConfiguredValueModifierFactory=liquibase.configuration.C...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2e2fca61: liquibase.logging.core.LogServiceFactory=liquibase.logging.core.LogServiceFactor...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2b1e4cbb: resourceAccessor=ClassLoaderResourceAccessor{}
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@38058acd: {liquibase.command.CommandFactory=liquibase.command.CommandFactory@67ca15fc, liq...
  reading field liquibase.util.SmartMap.values of constant 
    liquibase.util.SmartMap@6b9e54d8: liquibase.util.SmartMap@aad08fb6
  reading field liquibase.Scope.values of constant 
    liquibase.Scope@139984e7: scope(database=null)
  reading field liquibase.SingletonScopeManager.currentScope of constant 
    liquibase.SingletonScopeManager@2055a5cd: liquibase.SingletonScopeManager@2055a5cd
  reading static field liquibase.Scope.scopeManager
    at liquibase.Scope.getCurrentScope(Scope.java:76)
  parsing method liquibase.Scope.getCurrentScope(Scope.java:76) reachable via the parsing context
    at liquibase.plugin.AbstractPluginFactory.getPlugin(AbstractPluginFactory.java:41)
    at liquibase.license.LicenseServiceFactory.getLicenseService(LicenseServiceFactory.java:21)
    at root method.(Unknown Source)


	at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:798)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
Detailed message:
Trace: Object was reached by
  reading field java.util.Collections$UnmodifiableMap.m of constant 
    java.util.Collections$UnmodifiableMap@60f1a9d7: {Path=C:\Program Files\PowerShell\7;C:\hostedtoolcache\windows\graalvm-jdk-17_wi...
  reading field liquibase.configuration.core.EnvironmentValueProvider.environment of constant 
    liquibase.configuration.core.EnvironmentValueProvider@2c4d2364: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364
  reading field java.util.TreeMap$Entry.key of constant 
    java.util.TreeMap$Entry@36b5cd86: liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object@...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@62dcca70: liquibase.configuration.core.SystemPropertyValueProvider@379dad63=java.lang.Obje...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@27d6813e: liquibase.configuration.core.DeprecatedConfigurationValueProvider@5a0c0a0b=java....
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@12608c14: {liquibase.configuration.core.EnvironmentValueProvider@2c4d2364=java.lang.Object...
  reading field java.util.TreeSet.m of constant 
    java.util.TreeSet@5f8bb24e: [liquibase.configuration.core.EnvironmentValueProvider@2c4d2364, liquibase.confi...
  reading field liquibase.configuration.LiquibaseConfiguration.configurationValueProviders of constant 
    liquibase.configuration.LiquibaseConfiguration@3a8460d1: liquibase.configuration.LiquibaseConfiguration@3a8460d1
  reading field java.util.TreeMap$Entry.value of constant 
    java.util.TreeMap$Entry@715260d8: liquibase.configuration.LiquibaseConfiguration=liquibase.configuration.Liquibase...
  reading field java.util.TreeMap$Entry.right of constant 
    java.util.TreeMap$Entry@2dac1aff: liquibase.configuration.ConfiguredValueModifierFactory=liquibase.configuration.C...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2e2fca61: liquibase.logging.core.LogServiceFactory=liquibase.logging.core.LogServiceFactor...
  reading field java.util.TreeMap$Entry.left of constant 
    java.util.TreeMap$Entry@2b1e4cbb: resourceAccessor=ClassLoaderResourceAccessor{}
  reading field java.util.TreeMap.root of constant 
    java.util.TreeMap@38058acd: {liquibase.command.CommandFactory=liquibase.command.CommandFactory@67ca15fc, liq...
  reading field liquibase.util.SmartMap.values of constant 
    liquibase.util.SmartMap@6b9e54d8: liquibase.util.SmartMap@aad08fb6
  reading field liquibase.Scope.values of constant 
    liquibase.Scope@139984e7: scope(database=null)
  reading field liquibase.SingletonScopeManager.currentScope of constant 
    liquibase.SingletonScopeManager@2055a5cd: liquibase.SingletonScopeManager@2055a5cd
  reading static field liquibase.Scope.scopeManager
    at liquibase.Scope.getCurrentScope(Scope.java:76)
  parsing method liquibase.Scope.getCurrentScope(Scope.java:76) reachable via the parsing context
    at liquibase.plugin.AbstractPluginFactory.getPlugin(AbstractPluginFactory.java:41)
    at liquibase.license.LicenseServiceFactory.getLicenseService(LicenseServiceFactory.java:21)
    at root method.(Unknown Source)


	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:793)
	... 6 more
      83 types,    78 fields, and    68 methods registered for JNI access
       5 native libraries: crypt32, ncrypt, psapi, version, winhttp

@vincejv
Copy link

vincejv commented Sep 2, 2023

After checking with the source code for v3, seems like the fix done on #22449 was not ported over to Quarkus 3. I'm sure this is currently on low priority as this is isolated on windows, but if no one will shoot a PR, I would gladly do it myself in my free time given this has been unresolved since Quarkus 3.0.1, May 1, 2023.

@gsmet
Copy link
Member

gsmet commented Sep 2, 2023

Quarkus 3 was branched well after 2.10 so any patch in 2.10 would be in 3. This particular code might have been removed for whatever reason but it’s not as simple as « it wasn’t ported ».

@mcasperson
Copy link

Including a class like this will fix your local builds. It is basically the same as #22449, but I had to change the target class slightly to liquibase.configuration.core.EnvironmentValueProvider:

import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

import java.util.Map;

@TargetClass(className = "liquibase.configuration.core.EnvironmentValueProvider")
final class SubstituteEnvironmentValueProvider {

  @Delete
  private Map<String, String> environment;

  @Substitute
  protected Map<?, ?> getMap() {
    return System.getenv();
  }
}

@melloware
Copy link
Contributor

@gastaldi you made this fix in #22449 for liquibase.pro but the above fix looks like it has moved from .pro to .core or maybe its .core in the open source version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/liquibase env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants