symentis / grails-audit-logging-plugin

The Grails Audit Logging Plugin
Apache License 2.0
50 stars 60 forks source link

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

Open dmahapatro opened 8 years ago

dmahapatro commented 8 years ago

Grails version: 3.1.9 Plugin Version: 2.0.1

Steps to recreate:

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)
robertoschwald commented 8 years ago

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

dmahapatro commented 8 years ago

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.

robertoschwald commented 8 years ago

Tested the supposed fix, doesn't help :(

robertoschwald commented 8 years ago

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 commented 7 years ago

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