May 16th, 2011, 07:29 PM
Grails/Groovy integration in STS does not evaluate expressions
I just downloaded the STS 2.6.1 and the Grails/Groovy integration. Everything seems to work fine in terms of the ability to debug and view variables, but I cannot seem to evaluate expressions in the Expressions window. I put the name of a variable inside the "watch expression" window or the "display" window and I get an error:
See error log: org.eclipse.jdt.internal.debug.core.model.JDIPrimi tiveValue cannot be cast to org.eclipse.jdt.debug.core.IJavaObject
I even get this same error when evaluating 'System.out.println("Hello World!");'
May 17th, 2011, 12:12 PM
In what context are you running the evaluation? This could be a problem with how the groovy debug support is interpreting the current script or class.
Are you running in Groovy 1.7 or 1.8? Also, can you have a look at the error log and see if there are any relevant entries in the log?
Have you tried it with a very simple script? Eg-
def x = "hello"
Set a breakpoint at the second "x" and see if it works. Let me know if you have any luck
May 17th, 2011, 03:11 PM
I am using Groovy 1.7.8 (which got downloaded with the Grails STS plugin).
Creating a small Groovy class in a separate project is able to be debugged and expressions evaluate fine.
There is nothing in the error log window for my non-working project except for "Internal Error". More information is shown in the Expressions window:
org.eclipse.jdt.internal.debug.core.model.JDIPrimi tiveValue cannot be cast to org.eclipse.jdt.debug.core.IJavaObject.
The project I am trying to debug uses the Flex Grails Plugin. I will try a vanilla Grails application to see if that makes any difference, but I doubt it.
May 17th, 2011, 03:47 PM
Any chance that you can send me just the class that is causing your troubles? If there is proprietary info in it, feel free to obfuscate or PM me directly.
May 17th, 2011, 11:16 PM
Thanks. I received your email and I'll have a look at your project.
May 20th, 2011, 01:16 PM
I tried this first on the latest snapshot of STS and saw that this was working. I know that we have had some problems in this area in the past and it looks like STS 2.6.1 is using a grails tooling from March by default (from the 2.6.0 release). I've had few fixes in this area since then, so that may explain why it is not working for you but is for me.
I'd recommend first upgrading to Groovy-Eclipse 2.5.0 (if you don't already have that version). You can get it here;
And then grab the snapshot Grails tooling from here:
Let me know if this fixes your problem. This version also supports conditional breakpoints in groovy code using groovy syntax. It is still somewhat a new feature and so let me know also if you get a chance to use it (and how it works for you).
May 26th, 2011, 11:04 AM
Tags for this Thread