Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.0
-
Fix Version/s: 1.1-RC1
-
Component/s: Controllers, View technologies
-
Labels:None
-
Environment:Running locally with the in-memory database and using the scaffold controller, Windows XP, 1.0 snapshot build 142, jdk 5.x
Description
I have a demo grails application that can be used to re-create this error. I have a controller name ApplicationController, and corresponding Application domain class.
I can view the list applications web page (no records shown), but I can't add applications.
To recreate this bug, just run rails run-app and click on the Applications link from the home page. Then click on New Application link, you will see the following error
Message: Application cannot be cast to javax.servlet.ServletContext
Caused by: Application cannot be cast to javax.servlet.ServletContext
Class: Unknown
java.lang.ClassCastException: Application cannot be cast to javax.servlet.ServletContext
at WEB_INF_grails_app_views_application_create_jsp.run(WEB_INF_grails_app_views_application_create_jsp:9)
I suspect that I'm using a reserved name for my controller causing a class name conflict. If this is the case, it would be nice to know what tablename/fieldnames we should not be using to avoid this and get an error message that tells us this.
The bug is because there is a variable in the GSP binding called 'application' that is the ServletContext this gets overridden when you return the model from the controller [applicaton:Application.get(params.id)]
I wouldn't say its critical as changing the controller code would fix the problem