grails-audit-logging-plugin icon indicating copy to clipboard operation
grails-audit-logging-plugin copied to clipboard

Unable to load /env actuator endpoint in the app once plugin is used in the app

Open dmahapatro opened this issue 8 years ago • 5 comments

Grails version: 3.1.9 Plugin Version: 2.0.1

Steps to recreate:

  • Create a sample app
  • Add the plugin to build.gradle
  • Enable actuator endpoints in application.yml.
  • ./gradlew bootRun
  • visit http://localhost:8080/env

Enabling actuator endpoints in application.yml:

endpoints:
    enabled: true
    jmx:
        enabled: true
    env:
        sensitive: false

Stacktrace:

ERROR org.grails.web.errors.GrailsExceptionResolver - JsonMappingException occurred when processing request: [GET] /env
No serializer found for class groovy.lang.GroovyClassLoader$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.LinkedHashMap["AuditConfig"]->java.util.LinkedHashMap["grails"]->groovy.util.ConfigObject["plugin"]->groovy.util.ConfigObject["auditLog"]->groovy.util.ConfigObject["actorClosure"]->grails.plugins.orm.auditable.__clinit__closure3["delegate"]->grails.plugins.orm.auditable.AuditLogListener["grailsApplication"]->grails.core.DefaultGrailsApplication["classLoader"]->groovy.lang.GroovyClassLoader["resourceLoader"]). Stacktrace follows:
org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: No serializer found for class groovy.lang.GroovyClassLoader$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.LinkedHashMap["AuditConfig"]->java.util.LinkedHashMap["grails"]->groovy.util.ConfigObject["plugin"]->groovy.util.ConfigObject["auditLog"]->groovy.util.ConfigObject["actorClosure"]->grails.plugins.orm.auditable.__clinit__closure3["delegate"]->grails.plugins.orm.auditable.AuditLogListener["grailsApplication"]->grails.core.DefaultGrailsApplication["classLoader"]->groovy.lang.GroovyClassLoader["resourceLoader"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class groovy.lang.GroovyClassLoader$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.LinkedHashMap["AuditConfig"]->java.util.LinkedHashMap["grails"]->groovy.util.ConfigObject["plugin"]->groovy.util.ConfigObject["auditLog"]->groovy.util.ConfigObject["actorClosure"]->grails.plugins.orm.auditable.__clinit__closure3["delegate"]->grails.plugins.orm.auditable.AuditLogListener["grailsApplication"]->grails.core.DefaultGrailsApplication["classLoader"]->groovy.lang.GroovyClassLoader["resourceLoader"])
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class groovy.lang.GroovyClassLoader$1 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.LinkedHashMap["AuditConfig"]->java.util.LinkedHashMap["grails"]->groovy.util.ConfigObject["plugin"]->groovy.util.ConfigObject["auditLog"]->groovy.util.ConfigObject["actorClosure"]->grails.plugins.orm.auditable.__clinit__closure3["delegate"]->grails.plugins.orm.auditable.AuditLogListener["grailsApplication"]->grails.core.DefaultGrailsApplication["classLoader"]->groovy.lang.GroovyClassLoader["resourceLoader"])
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:69)
    at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:32)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:561)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:469)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:29)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:561)

dmahapatro avatar Jul 24 '16 00:07 dmahapatro

Reproduced.

Same issue reported by another one. spring-boot-actuator problem? http://stackoverflow.com/questions/38195998/spring-boot-actuator-env-endpoint-response-malformed-when-closure-specified-in

robertoschwald avatar Jul 25 '16 15:07 robertoschwald

Looks like it. But your fix will keep this plugin out of the radar. :) Thank you for the fix. I am preoccupied with bunch of other stuff otherwise I would have sent a PR after thorough testing. If possible please do a sanity check for other available actuator endpoints.

dmahapatro avatar Jul 25 '16 15:07 dmahapatro

Tested the supposed fix, doesn't help :(

robertoschwald avatar Jul 25 '16 16:07 robertoschwald

When I annotate AuditLogListener.grailsApplication with "@JsonIgnore", I get a different error when using JDK 1.7.0_79 in the audit-test application (Grails 3.0.10):

*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at JPLISAgent.c line: 844

robertoschwald avatar Jul 25 '16 18:07 robertoschwald

Is a Jackson error. We reported to https://github.com/grails/grails-core/issues/10279

robertoschwald avatar Nov 01 '16 08:11 robertoschwald