Skip to content

Native Image broken after upgrade to 3.0.6 - MissingResourceException: Can't find bundle for base name org.aspectj.weaver.weaver-messages #35104

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

Closed
lambliesdown opened this issue Apr 21, 2023 · 7 comments
Labels
status: duplicate A duplicate of another issue

Comments

@lambliesdown
Copy link

lambliesdown commented Apr 21, 2023

After an upgrade from 3.0.5 to 3.0.6 yesterday, our natively compiled applications are failing to start. Apparently the resource org.aspectj.weaver.weaver-messages is not included automatically anymore. After adding the resource explicitly with a ResourceHint, the startup gets beyond this point but has other issues later (will submit separate issue for that).
Things worked perfectly fine without any special ResourceHint with 3.0.x up to 3.0.5.
Using the Gradle plugin org.graalvm.buildtools.native - version 0.9.20
See attached stacktrace.
stacktrace.txt

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 21, 2023
@matthenry87
Copy link

In the meantime, you can configure the GraalVM native image to pick up the prior release version of the reachability metadata repository.

https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#_configuring_the_metadata_repository

Version 0.2.6 is the prior version that may have previously been working for you. Alternatively, you can target specific hint versions for individual dependencies.

@lambliesdown
Copy link
Author

I haven't tried that yet, but I don't think that'll help. The aspectj library doesn't seem to be part of GraalVM's metadata repository.

@matthenry87
Copy link

You need to tell the GraalVM compiler that it should include the file it's looking for at compile time. Create src/main/resources/META-INF/native-image/resource-config.json and inside :

{
    "resources":
    {
        "includes":
        [
            {
                "pattern": "\\Qorg/aspectj/weaver/weaver-messages.properties\\E"
            }
        ]
    }
}

That will likely get you past that error - but then potentially onto the next one. Nature of the game :)
https://www.graalvm.org/22.0/reference-manual/native-image/Resources/

Same story for reflection, dynamic class loading, and proxies. Have to tell GraalVM native image compiler about them in advance.

I've become more familiar with the tracing agent - huge help. Run it once, and then use it's output to search for the hints - for the classes/files you get errors about, then pull the needed hint(s) into your own set.

@matthenry87
Copy link

Then - you can also come more correct when reporting issue, with what hints you added to fix the problem - so the Spring Boot team can add them if needed.

On that note - a small bare-bones reproducer project will likely be asked of you if you want someone else to go through this stuff instead.

@wilkinsona
Copy link
Member

Spring Boot doesn't provide any hints for AspectJ so I'm not sure why this worked previously. Perhaps something else was providing the necessary hints either intentionally or through an accidentally too-broad pattern. A minimal example should help us to track down why this worked before so that we can identify the right place for a fix. Can you please provide one, @lambliesdown?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Apr 22, 2023
@lambliesdown
Copy link
Author

Just realized that my issue is pretty much the same as #35049.
I wasn't able to strip down my project to an easily reproducible example. It just happened that the weaver-messages.properties was included in the AOT generated resource-config.json in my bigger project with lots of dependencies in Spring Boot 3.0.5. and now it isn't any more.
I got things to work with the hints suggested in #35049.
Closing this issue as duplicate.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2023
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Apr 22, 2023
@wilkinsona
Copy link
Member

Thanks for letting us know, @lambliesdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants