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

'java.lang.module.FindException: Unable to derive module descriptor' when using module path with micrometer-core #3398

Closed
moarychan opened this issue Sep 9, 2022 · 13 comments
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Milestone

Comments

@moarychan
Copy link

Describe the bug
The compilation failure occurs in our CI pipeline when building using Java 11, here is a temp URL to see the console log.

I can see the module name is correct in version 1.10.0-M3.
image

It works fine in our CI pipelines based on Java 8.

[ERROR] Error occurred during initialization of boot layer
[ERROR] java.lang.module.FindException: Unable to derive module descriptor for D:\a\_work\1\.m2\repository\io\micrometer\micrometer-core\1.10.0-M3\micrometer-core-1.10.0-M3.jar

Environment

  • Micrometer version [1.10.0-M3]
  • OS: [windows server 2019]
  • Java version: [11.0.16.1, vendor: Eclipse Adoptium, runtime: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.16-101\x64]

To Reproduce
How to reproduce the bug:
Please follow this steps:

  • Checkout this branch https://github.com/moarychan/azure-sdk-for-java/tree/moary/migrate-spring-data-cosmos-to-spring-dir

  • Or sparse checkout below parts:

    /*
    !/*/
    /eng
    **/*.xml
    /sdk/cosmos
    /sdk/formrecognizer
    /sdk/parents
    /sdk/spring  
  • Run the below command in the root project:
    mvn.cmd -f pom.xml --batch-mode --fail-at-end --settings eng/settings.xml -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Dgpg.skip -Dmaven.javadoc.skip=true -Dcodesnippet.skip=true -Dspotbugs.skip=true -Dcheckstyle.skip=true -Drevapi.skip=true -DtrimStackTrace=false -pl com.azure:azure-cosmos, -DAZURE_TEST_DEBUG=false -Dparallel-test-playback=true -Punit -T 1C verify

Expected behavior
Normal use.

Additional context
N/A

@jonatan-ivanov
Copy link
Member

Can you try what happens if you build against M4?
Can you build it locally? (I would also try wiping out micrometer from your maven cache.)

Are you sure this is caused by micrometer? And not something else, e.g.: your JVM crashed:

[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

@jonatan-ivanov jonatan-ivanov added waiting for feedback We need additional information before we can continue and removed waiting-for-triage labels Sep 9, 2022
@moarychan
Copy link
Author

Thanks for your update.

When using M4, the same error occurs,
image

I am not sure this is caused by micrometer, but this error message seems to have appeared before the JVM crashed.

Could you please help double-check this error message? Many thanks!

@saragluna
Copy link

saragluna commented Sep 13, 2022

I tried to run java -p ~/.m2/repository/io/micrometer/micrometer-core/1.10.0-M3/micrometer-core-1.10.0-M3.jar --list-modules for micrometer-core version 1.10.0-M3 and got the following error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /Users/xxx/.m2/repository/io/micrometer/micrometer-core/1.10.0-M3/micrometer-core-1.10.0-M3.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor not in module

@saragluna
Copy link

@jonatan-ivanov seems like the issue was caused by

io.micrometer.observation.contextpropagation.ObservationThreadLocalAccessor
?

@moarychan
Copy link
Author

I have seen the below information, does this indicate the JVM crashed with the micrometer module exception?

image

@jonatan-ivanov could you help give a workaround to fix this exception? Thanks! We are preparing to release a milestone version for Spring Boot 3 support.

@shakuzen
Copy link
Member

@saragluna thank you for narrowing it down. It appears to be an issue with our automatic-modules and the service loader. We're trying to look into it on our end but don't immediately know why there is an issue or how to fix it - perhaps adding module descriptors would fix it, but we'd rather stick with automatic modules for now if we can. If anyone is familiar with this issue and has ideas, please share.

@shakuzen shakuzen added help wanted An issue that a contributor can help us with bug A general bug and removed waiting for feedback We need additional information before we can continue labels Sep 13, 2022
@shakuzen shakuzen added this to the 1.10 backlog milestone Sep 13, 2022
@saragluna
Copy link

@shakuzen shakuzen modified the milestones: 1.10 backlog, 1.10.0-RC1 Sep 13, 2022
@shakuzen shakuzen changed the title Occurs 'java.lang.module.FindException: Unable to derive module descriptor' when using Java 11 with micrometer-core:1.10.0-M3 'java.lang.module.FindException: Unable to derive module descriptor' when using module path with micrometer-core 1.10.0-M5 Sep 13, 2022
@shakuzen shakuzen removed the help wanted An issue that a contributor can help us with label Sep 13, 2022
@shakuzen
Copy link
Member

shakuzen commented Sep 13, 2022

@saragluna indeed we shouldn't need it in both places. I think it was an oversight it ended up in both modules. Thank you for catching that. I have removed the service provider config file from micrometer-core now. I tried it locally and the --list-modules command works on the micrometer-core jar now.

Would you be able to try out the latest snapshot to let us know if things are working fine now?

Our next planned (pre-)release is the RC1 version for Micrometer 1.10 on October 10. Is that alright for you all or is this issue blocking a release you would like to do sooner than that? We can consider doing an unplanned release sooner if it is critical for you all.

@shakuzen shakuzen added the module: micrometer-core An issue that is related to our core module label Sep 13, 2022
@saragluna
Copy link

Thanks @shakuzen! We'll first test the snapshot version and let you know later whether we need a release.

@jonatan-ivanov
Copy link
Member

@saragluna @moarychan Thank you for the details, please let us know if this is fixed on your side.
Also, fyi, we are adding a check to our build based on your feedback to detect things like this: #3411

It seems the newrelic registry still has issues, please let us know if you are building against it.

@moarychan
Copy link
Author

Hi @jonatan-ivanov thanks for your support, I just passed the artifact building using the snapshot version, we still need a release version for our pipeline side to finish lots of verification, please help to release a new version.

@shakuzen shakuzen modified the milestones: 1.10.0-RC1, 1.10.0-M6 Sep 14, 2022
shakuzen pushed a commit that referenced this issue Sep 14, 2022
Adds a task called `testModules` that calls `java --list-modules` on each JAR file built to check that its modules can be listed. We have had issues in the past that went unnoticed, and this is one of the easiest ways to do a sanity check that a JAR will work on the module path. See, for example, gh-3398 and gh-3412, which would have been caught by this check.
@shakuzen shakuzen changed the title 'java.lang.module.FindException: Unable to derive module descriptor' when using module path with micrometer-core 1.10.0-M5 'java.lang.module.FindException: Unable to derive module descriptor' when using module path with micrometer-core Sep 14, 2022
@shakuzen
Copy link
Member

@moarychan Micrometer 1.10.0-M6 is now published to the milestones repository. Can you use that to verify things are fixed?

@moarychan
Copy link
Author

Yes, thanks for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Projects
None yet
Development

No branches or pull requests

4 participants