Skip to content

JDK bundles are not discovered and added to native image with JDK16 #3404

@ilopmar

Description

@ilopmar

Describe the issue

Bundles included in JDK 16 are not discovered and can't be included in the native image.

I have an application that declares the following in resource-config.json:

{
  "resources": {
    "includes": []
  },
  "bundles": [
    {"name": "com.sun.org.apache.xerces.internal.impl.xpath.regex.message"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.DatatypeMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.DOMMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.SAXMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages"},
    {"name": "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages"}
  ]
}

When building a native image with GraalVM JDK11 every works and all those bundles are included in the native image.

If I try to build the native image with GraalVM JDK16 (compiled from master branch) there are warnings about those bundles not being found, and thus, not being included in the native image.

The bundles are present in both JDK11 & 16:

JDK 11

image

JDK 16

image

Steps to reproduce the issue

I've created a very simple hello world app with the previous resource-config.json file to illustrate the problem.

  • git clone https://github.com/ilopmar/graalvm-issue-jdk16-bundles
  • cd graalvm-issue-jdk16-bundles
  • Use GraaVM JDK16 compiled from master branch
  • ./build-native-image.sh

During native image generation we can see the following warnings:

[my-app:169076]    classlist:     533.07 ms,  0.96 GB
[my-app:169076]        (cap):     435.69 ms,  0.96 GB
[my-app:169076]        setup:   1,589.10 ms,  0.96 GB
The bundle named: com.sun.org.apache.xerces.internal.impl.xpath.regex.message, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.DatatypeMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.DOMMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.JAXPValidationMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.SAXMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.XMLMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
[my-app:169076]     (clinit):     134.85 ms,  1.22 GB
[my-app:169076]   (typeflow):   3,619.45 ms,  1.22 GB
[my-app:169076]    (objects):   3,305.42 ms,  1.22 GB
[my-app:169076]   (features):     235.11 ms,  1.22 GB
[my-app:169076]     analysis:   7,463.60 ms,  1.22 GB
[my-app:169076]     universe:     271.81 ms,  1.22 GB
[my-app:169076]      (parse):     720.00 ms,  1.69 GB
[my-app:169076]     (inline):     863.66 ms,  1.69 GB
[my-app:169076]    (compile):   4,688.34 ms,  2.33 GB
[my-app:169076]      compile:   6,677.85 ms,  2.33 GB
[my-app:169076]        image:   1,210.21 ms,  2.33 GB
[my-app:169076]        write:     140.52 ms,  2.33 GB
# Printing build artifacts to: /home/ivan/workspaces/misc/basic-jdk16-app/my-app.build_artifacts.txt
[my-app:169076]      [total]:  18,110.17 ms,  2.33 GB

Now switch to GraalVM 21.1 JDK11 and create the native image again:

[my-app:169627]    classlist:     726.34 ms,  0.96 GB
[my-app:169627]        (cap):     386.42 ms,  0.96 GB
[my-app:169627]        setup:   1,604.13 ms,  0.96 GB
[my-app:169627]     (clinit):     141.27 ms,  1.68 GB
[my-app:169627]   (typeflow):   4,108.72 ms,  1.68 GB
[my-app:169627]    (objects):   3,917.23 ms,  1.68 GB
[my-app:169627]   (features):     287.73 ms,  1.68 GB
[my-app:169627]     analysis:   8,794.90 ms,  1.68 GB
[my-app:169627]     universe:     325.43 ms,  1.68 GB
[my-app:169627]      (parse):     727.20 ms,  1.68 GB
[my-app:169627]     (inline):     931.23 ms,  1.69 GB
[my-app:169627]    (compile):   5,073.26 ms,  3.23 GB
[my-app:169627]      compile:   7,226.39 ms,  3.23 GB
[my-app:169627]        image:   1,248.52 ms,  3.23 GB
[my-app:169627]        write:     372.31 ms,  3.13 GB
# Printing build artifacts to: my-app.build_artifacts.txt
[my-app:169627]      [total]:  20,505.66 ms,  3.13 GB

You can see that there are no warnings with JDK11.

As mentioned before this a very basic reproducer. This is failing in Micronaut Liquibase integration because Liquibase tries to find some of those message bundles during startup and it fails because it can't find them.

Describe GraalVM and your environment:

  • GraalVM version: 21.2.0-dev compiled from d5ec6c8
  • JDK major version: 16
  • OS: Linux Mint 20.1 Cinnamon
  • Architecture: AMD64

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions