Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GStringImpl cannot be cast to java.lang.String

Tags:

grails

I got the error below using Grails and Spring Security. Has anyone else had a problem like this? If so, what was your fix?

Error |
Exception in thread "Thread-15" 
Error |
java.lang.ClassCastException: org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String
Error |
    at org.codehaus.groovy.grails.project.compiler.GrailsProjectWatcher.run(GrailsProjectWatcher.java:114)

And

java.lang.IllegalArgumentException: Failed to evaluate expression 'User_name'
like image 217
user3710320 Avatar asked Mar 16 '15 14:03

user3710320


1 Answers

Did you generate all the classes (User, Role ...). How does your command looks like? Like this grails s2-quickstart com.testapp User Role? Check your configuration and try it like in this tutorial. Spring Security Plugin Tutorials

Actually this error means in groovy that you use a GString like "${my_var}" and some class expects String. It can't be cast automatically. If you have some code like this, you have to convert it to String like this: "${my_var}".toString().

like image 94
CyberAleks Avatar answered Oct 24 '22 01:10

CyberAleks