Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.0-JSR-3
-
Component/s: Groovlet / GSP
-
Labels:None
-
Number of attachments :
Description
Groovy can't reflect classes which are unknown to the its ClassLoader when using MetaClass.setUseReflection(false) even if it could cast to a known interface.
For example Tomcat will replace System.out with a custom PrintStream instead of the default and when you try to use System.out and setUseReflection is set to false every call to System.out will fail with:
java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/SystemLogHandler
gjdk.org.apache.tomcat.util.log.SystemLogHandler_GroovyReflector.invoke(SystemLogHandler_GroovyReflector.java)
groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:996)
I packaged a complete war file to show the behaviour.
It can be found at http://home.mx4k.com/test.war
You should be able to call: http://yourhost/test/test.groovy to see the problem. If you use the default groovy.servlet.GroovyServlet the example works but I couldn't come up with an "easier" test to show this behaviour.
Issue Links
- is duplicated by
-
GROOVY-210
System.out and classloader issues under Tomcat
-
Sorry, the .war file got lost in a hd-crash. I know I should have attached it.