Open mshannongit opened 2 years ago
> Task :dockerBuildNative
Building image using context '/Users/mshannon/developer/git/reproducer/build/docker/native-main'.
Using Dockerfile '/Users/mshannon/developer/git/reproducer/build/docker/native-main/DockerfileNative'
Using images 'reproducer'.
Step 1/12 : FROM ghcr.io/graalvm/native-image:ol8-java17-22.0.0.2 AS graalvm
---> 4f88414443ef
Step 2/12 : WORKDIR /home/app
---> Using cache
---> 2445cb20b915
Step 3/12 : COPY layers/libs /home/app/libs
---> f1a8e419a4c0
Step 4/12 : COPY layers/classes /home/app/classes
---> 38d435c9c769
Step 5/12 : COPY layers/resources /home/app/resources
---> 43879c2287c2
Step 6/12 : COPY layers/application.jar /home/app/application.jar
---> d86936843b12
Step 7/12 : RUN mkdir /home/app/config-dirs
---> Running in d48a0e3e0dfc
Removing intermediate container d48a0e3e0dfc
---> 814d80345f8c
Step 8/12 : COPY config-dirs/generateResourcesConfigFile /home/app/config-dirs/generateResourcesConfigFile
---> 5dd39a4497f9
Step 9/12 : RUN native-image -cp /home/app/libs/*.jar:/home/app/resources:/home/app/application.jar --no-fallback -H:Name=application -H:ConfigurationFileDirectories=/home/app/config-dirs/generateResourcesConfigFile -H:Class=test.Application
---> Running in fdfce56b055d
========================================================================================================================
GraalVM Native Image: Generating 'application'...
========================================================================================================================
[1/7] Initializing... (9.4s @ 0.27GB)
Version info: 'GraalVM 22.0.0.2 Java 17 CE'
3 user-provided feature(s)
- io.micronaut.buffer.netty.NettyFeature
- io.micronaut.http.netty.graal.HttpNettyFeature
- io.micronaut.jackson.JacksonDatabindFeature
[2/7] Performing analysis... [**] (103.4s @ 2.00GB)
Warning: class initialization of class io.micronaut.configuration.mongo.reactive.$DefaultReactiveMongoClientFactory$MongoClient0$Definition$Intercepted$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.configuration.mongo.reactive.$DefaultReactiveMongoClientFactory$MongoClient0$Definition$Intercepted$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.configuration.mongo.reactive.$DefaultReactiveMongoClientFactory$MongoClient0$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.configuration.mongo.reactive.$DefaultReactiveMongoClientFactory$MongoClient0$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.configuration.mongo.reactive.$NamedReactiveMongoClientFactory$MongoClient0$Definition$Intercepted$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.configuration.mongo.reactive.$NamedReactiveMongoClientFactory$MongoClient0$Definition$Intercepted$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.configuration.mongo.reactive.$NamedReactiveMongoClientFactory$MongoClient0$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.configuration.mongo.reactive.$NamedReactiveMongoClientFactory$MongoClient0$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.configuration.mongo.reactive.health.$MongoHealthIndicator$Definition failed with exception java.lang.NoClassDefFoundError: io/micronaut/management/health/indicator/HealthIndicator. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.configuration.mongo.reactive.health.$MongoHealthIndicator$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.data.mongodb.database.$MongoReactiveFactory$NamedMongoDatabaseFactory1$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.data.mongodb.database.$MongoReactiveFactory$NamedMongoDatabaseFactory1$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.data.mongodb.init.$MongoReactiveCollectionsCreator$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoDatabase. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.data.mongodb.init.$MongoReactiveCollectionsCreator$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.data.mongodb.operations.$DefaultReactiveMongoRepositoryOperations$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoDatabase. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.data.mongodb.operations.$DefaultReactiveMongoRepositoryOperations$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.transaction.jdbc.$DelegatingDataSourceResolver$Definition failed with exception java.lang.NoClassDefFoundError: io/micronaut/jdbc/DataSourceResolver. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.transaction.jdbc.$DelegatingDataSourceResolver$Definition to explicitly request delayed initialization of this class.
Warning: class initialization of class io.micronaut.data.mongodb.database.$MongoReactiveFactory$PrimaryMongoDatabaseFactory0$Definition failed with exception java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client/MongoClient. This class will be initialized at run time because option --allow-incomplete-classpath is used for image building. Use the option --initialize-at-run-time=io.micronaut.data.mongodb.database.$MongoReactiveFactory$PrimaryMongoDatabaseFactory0$Definition to explicitly request delayed initialization of this class.
To see how the classes got initialized, use --trace-class-initialization=org.bson.codecs.BsonValueCodecProvider,org.bson.codecs.BsonTypeClassMap,org.bson.conversions.Bson,org.bson.codecs.jsr310.Jsr310CodecProvider,org.bson.BsonDocument
15,058 (91.85%) of 16,395 classes reachable
20,159 (63.25%) of 31,874 fields reachable
71,010 (68.97%) of 102,955 methods reachable
908 classes, 311 fields, and 1,979 methods registered for reflection
Error: Classes that should be initialized at run time got initialized during image building:
org.bson.codecs.BsonValueCodecProvider was unintentionally initialized at build time. To see why org.bson.codecs.BsonValueCodecProvider got initialized use --trace-class-initialization=org.bson.codecs.BsonValueCodecProvider
org.bson.codecs.BsonTypeClassMap was unintentionally initialized at build time. To see why org.bson.codecs.BsonTypeClassMap got initialized use --trace-class-initialization=org.bson.codecs.BsonTypeClassMap
org.bson.conversions.Bson was unintentionally initialized at build time. To see why org.bson.conversions.Bson got initialized use --trace-class-initialization=org.bson.conversions.Bson
org.bson.codecs.jsr310.Jsr310CodecProvider was unintentionally initialized at build time. To see why org.bson.codecs.jsr310.Jsr310CodecProvider got initialized use --trace-class-initialization=org.bson.codecs.jsr310.Jsr310CodecProvider
org.bson.BsonDocument was unintentionally initialized at build time. To see why org.bson.BsonDocument got initialized use --trace-class-initialization=org.bson.BsonDocument
Possibly related to https://github.com/micronaut-projects/micronaut-data/issues/1504
please try with 3.5.2
Expected Behavior
GraalVM Native Image generation should succeed.
Actual Behaviour
dockerBuildNative task fails with:
Error: Classes that should be initialized at run time got initialized during image building: org.bson.codecs.BsonValueCodecProvider was unintentionally initialized at build time. To see why org.bson.codecs.BsonValueCodecProvider got initialized use --trace-class-initialization=org.bson.codecs.BsonValueCodecProvider org.bson.codecs.BsonTypeClassMap was unintentionally initialized at build time. To see why org.bson.codecs.BsonTypeClassMap got initialized use --trace-class-initialization=org.bson.codecs.BsonTypeClassMap org.bson.conversions.Bson was unintentionally initialized at build time. To see why org.bson.conversions.Bson got initialized use --trace-class-initialization=org.bson.conversions.Bson org.bson.codecs.jsr310.Jsr310CodecProvider was unintentionally initialized at build time. To see why org.bson.codecs.jsr310.Jsr310CodecProvider got initialized use --trace-class-initialization=org.bson.codecs.jsr310.Jsr310CodecProvider org.bson.BsonDocument was unintentionally initialized at build time. To see why org.bson.BsonDocument got initialized use --trace-class-initialization=org.bson.BsonDocument
Steps To Reproduce
native-issue-mongo-bsondocument.zip
Environment Information
macOS Monterey 12.4 (Intel)
openjdk version "17.0.2" 2022-01-18
Rancher Desktop 1.4.1 - dockerd (moby) API - 12GB memory allocated
ghcr.io/graalvm/native-image ol8-java17-22.0.0.2
Example Application
No response
Version
3.4.2