javamelody / grails-melody-plugin

JavaMelody monitoring plugin for Grails, to monitor application performance
https://plugins.grails.org/plugin/grails-melody-plugin
Apache License 2.0
32 stars 31 forks source link

Plugin breaks Grails 3.2.11 #43

Closed hugheba closed 6 years ago

hugheba commented 7 years ago

If you create a fresh Grails 3.2.11 project and add the dependency

runtime 'org.grails.plugins:grails-melody-plugin:1.67.0'

You'll get errors with Taglibs.

I created a simple view with a g:link and am getting this error.

`2017-06-28 11:46:53.983 ERROR --- [nio-8972-exec-1] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.grails.gsp.GroovyPagesException: Error processing GroovyPageView: [views/index/index.gsp:12] Error executing tag : No signature of method: java.lang.String.encodeAsHTML() is applicable for argument types: () values: [] Possible solutions: encodeAsHex(), encodeAsSHA1(), encodeAsMD5(), encodeAsSHA256()] with root cause

groovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsHTML() is applicable for argument types: () values: [] Possible solutions: encodeAsHex(), encodeAsSHA1(), encodeAsMD5(), encodeAsSHA256()`

Mac OS X 10.12.5 Java 1.8.131 Grails 3.2.11

evernat commented 7 years ago

Sorry, I do not reproduce the issue. By using the sample project at https://github.com/evernat/grails-ssl it works correctly with Grails 3.2.11 and Java 1.8. https://localhost:8443/ and https://localhost:8443/monitoring are OK. What would cause this sample project to break?

jglapa commented 7 years ago

@evernat just add <g:link controller="test">foo</g:link> to index.gsp and it will start throwing the exception

jglapa commented 7 years ago

This was also raised by me in grails repo: https://github.com/grails/grails-core/issues/10715

demon101 commented 7 years ago

I got the same bug. Can be reproduced by line in BootStrap.init: "some text".encodeAsLink()

As I remember, I have had got same error in Grails 3.2.10

@evernat Any workarounds?

demon101 commented 7 years ago

@graemerocher suggested in https://github.com/grails/grails-core/issues/10715:

My guess is something to do with the Groovy version, Groovy 2.4.11 is used in 3.2.11

evernat commented 7 years ago

As said in https://github.com/grails/grails-core/issues/10715#issuecomment-313971674, it seems to be caused by a regression between groovy 2.4.8 and groovy 2.4.9. To workaround the issue, you may want to add compile 'org.codehaus.groovy:groovy-all:2.4.8' in the dependencies of the build.gradle file of your app.

demon101 commented 7 years ago

@evernat using groovy 2.4.8 with grails 3.2 acceptable only as a workaround. Old version of groovy as long term solution -- bad idea. For example, a performance of Groovy 2.4.10 has been improved by 15-20 %.

Do you plan to fix the plugin?

graemerocher commented 7 years ago

I recommend reporting the issue to the Groovy issue tracker https://github.com/grails/grails-core/issues/10715

jglapa commented 7 years ago

@evernat would it be possible to test the following:

Perhaps the issue goes away if the plugin itself is build by groovy > 2.4.9 ?

evernat commented 7 years ago

@jglapa @sergiomichels It seems that building the grails-melody-plugin with the following in gradle.properties of the plugin fixes this issue:

grailsVersion=3.2.11
grailsWrapperVersion=1.0.0
gradleWrapperVersion=3.4.1

But I am not sure of what I was doing in the plugin for testing this. Sergio, could you check that this change in the plugin will fix the error displayed by the sample project: https://github.com/evernat/grails-ssl ?

jglapa commented 7 years ago

@evernat https://github.com/grails/grails-core/issues/10715#issuecomment-317304931

jukin-jerry commented 7 years ago

Created https://github.com/javamelody/grails-melody-plugin/pull/50

jukin-jerry commented 7 years ago

The Pull Request (50) above does indeed fix the problem described in this ticket under Grails 3.3.0, but a new problem emerges: now melody does not load at startup. The only other change is upgrading the java-melody-core dependency to 1.68.1.

Here are the messages at application startup, indicating the problem.

2017-08-02 02:42:16.422  INFO 11581 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4443b126: startup date [Wed Aug 02 02:42:16 UTC 2017]; root of context hierarchy
2017-08-02 02:42:18.038  WARN 11581 --- [  restartedMain] org.grails.plugins.CorePluginFinder      : [GrailsPluginManager] Core plugin [grails.melody.plugin.GrailsMelodyPluginGrailsPlugin] not found, resuming load without..
evernat commented 6 years ago

PR #50 is merged. Thanks to all and in particular to @graemerocher and @bassmartin.