Grails

formRemote not working in Google AppEngine

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.1.1
  • Fix Version/s: 1.2-M2
  • Component/s: TagLib
  • Labels:
    None
  • Environment:
    Google AppEngine 1.2.1

Description

If you try to use a formRemote tag on Google AppEngine it will function correctly on the development server however you will get the following exception in the logs on the actual production server.

[inadition/5.334872088869876828].<stderr>: java.lang.SecurityException: java.lang.IllegalAccessException: Reflection is not allowed on private final char[] java.lang.String.value

It took a while but I believe the problem is in the JavascriptTagLib.groovy (line 394).

def jsParams = attrs.params?.findAll { it.value instanceof JavascriptValue }

jsParams?.each { attrs.params?.remove(it.key) }

The formRemote is actually passing in params as a String, in order to function on AppEngine you need to wrap this with a check:

def jsParams = [:]
if(attrs.params instanceof Map) {
jsParams = attrs.params?.findAll { it.value instanceof JavascriptValue }
jsParams?.each { attrs.params?.remove(it.key) }
}

Activity

Hide
George Stathis added a comment -

"java.lang.IllegalAccessException: Reflection is not allowed" messages seem to be thrown in several places in the Tag libs. Similar exceptions are thrown for g:form and g:submitToRemote. As Philip mentions, these errors are not seen when running the development server locally. Only when deploying an application to GAE. The latter considers these errors critical and does not let the application run. Mine keeps giving me 500 errors.

Show
George Stathis added a comment - "java.lang.IllegalAccessException: Reflection is not allowed" messages seem to be thrown in several places in the Tag libs. Similar exceptions are thrown for g:form and g:submitToRemote. As Philip mentions, these errors are not seen when running the development server locally. Only when deploying an application to GAE. The latter considers these errors critical and does not let the application run. Mine keeps giving me 500 errors.
Hide
George Stathis added a comment -

BTW, I just tried Philip's fix and it did address the g:formRemote issue. Not sure about g:form and g:submitToRemote though.

Show
George Stathis added a comment - BTW, I just tried Philip's fix and it did address the g:formRemote issue. Not sure about g:form and g:submitToRemote though.
Hide
Graeme Rocher added a comment -

Fixed this one. @George if you can open separate issues with steps to reproduce for the other problems we can look at them.

Show
Graeme Rocher added a comment - Fixed this one. @George if you can open separate issues with steps to reproduce for the other problems we can look at them.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: