question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

During incremental compilation, configuration property metadata isn't generated for classes annotated with @ControllerEndpoint, @JmxEndpoint, @RestControllerEndpoint, @ServletEndpoint, or @WebEndpoint

See original GitHub issue

We’ve seen this a few times when building locally. The build fails like this:

> Task :spring-boot-project:spring-boot-docs:asciidoctor
Feb 22, 2021 9:50:24 AM asciidoctor
WARNING: Configuration property 'management.endpoint.jolokia.enabled' not found.
Exception in thread "main" org.asciidoctor.gradle.remote.AsciidoctorRemoteExecutionException: ERROR: The following messages from AsciidoctorJ are treated as errors:
Configuration property 'management.endpoint.jolokia.enabled' not found.
        at org.asciidoctor.gradle.remote.ExecutorBase.failOnWarnings(ExecutorBase.groovy:223)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:1011)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:994)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(InvokerHelper.java:97)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure3.doCall(AsciidoctorJavaExec.groovy:74)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure3.call(AsciidoctorJavaExec.groovy)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2330)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2315)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2356)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:67)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:49)

Our current theory is that it’s a bug in the annotation processor when it’s being run incrementally. In this case, we can see that Asciidoctor ran at 9:50:24. Looking at the file system, the JSON file was written at 09:49:

$ ls -al spring-boot-project/spring-boot-actuator-autoconfigure/build/classes/java/main/META-INF/spring-configuration-metadata.json 
-rw-r--r--  1 awilkinson  staff  87298 22 Feb 09:49 spring-boot-project/spring-boot-actuator-autoconfigure/build/classes/java/main/META-INF/spring-configuration-metadata.json

The build scan shows that spring-boot-actuator-autoconfigure:compileJava ran due to the following changes:

Input property 'classpath' file spring-boot-project/spring-boot-autoconfigure/build/classes/java/main/org/springframework/boot/autoconfigure/jdbc/DataSourceInitialization.class has been removed.
Input property 'classpath' file spring-boot-project/spring-boot-autoconfigure/build/classes/java/main/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration$BeforeJpaDataSourceInitializationConfiguration.class has been added.
Input property 'classpath' file spring-boot-project/spring-boot-autoconfigure/build/classes/java/main/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializationConfiguration$BeforeJpaDataSourceInitializationConfiguration.class has been removed.

The metadata contains the management.endpoint.jolokia group:

{
    "name": "management.endpoint.jolokia",
    "type": "org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaProperties",
    "sourceType": "org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaProperties"
},

It also contains the management.endpoint.jolokia.config property. Note that the group is as a result of processing the @ConfigurationProperties class. When the .enabled property is present, there’s another management.endpoint.jolokia group:

{
  "name": "management.endpoint.jolokia",
  "type": "org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpoint",
  "sourceType": "org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpoint"
},

It appears to be behaving as if the @Endpoint annotation isn’t on the classpath, or the @Endpoint-annotated classes aren’t in the RoundEnvironment.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
wilkinsonacommented, Feb 24, 2021

I think this is much simpler than we’d been thinking. JolokiaEndpoint is a @ServletEndpoint yet the annotation processor only claims support for @Endpoint. When Gradle is compiling incrementally it doesn’t include JolokiaEndpoint in the RoundEnvironment as it isn’t annotated with an annotation that the processor claims to support. We need to add @ServletEndpoint to the supported types declared by ConfigurationMetadataAnnotationProcessor.

0reactions
wilkinsonacommented, Mar 25, 2021

2.3.x doesn’t have this problem as it uses *.

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring-configuration-metadata.json file is not generated in ...
json file is not generated (I've tried both gradle build and Idea Rebuild Project). @ConfigurationProperties("myprops") class MyProps { var hello: String? = ...
Read more >
Bump spring-boot-starter-parent from 2.0.2.RELEASE to 2.4.5 in ...
During incremental compilation, configuration property metadata isn't generated for classes annotated with @ControllerEndpoint, @JmxEndpoint, ...
Read more >
Spring Boot Actuator: Production-ready Features
Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production.
Read more >
spring-projects/spring-boot v2.4.5 on GitHub - NewReleases.io
... During incremental compilation, configuration property metadata isn't generated for classes annotated with @ControllerEndpoint , @JmxEndpoint ...
Read more >
chore(deps): update all dependencies (major) (!151 ... - GitLab
This MR contains the following updates: Package Change Age Adoption Passing Confidence.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found