Grails 2.2.x and the problem with inner classes

We have been using Grails 2.2.x in some of our projects since it came out last year. Last week when I tried to upgrade another project because it was time to develop some new features I ran into a strange problem after upgrading from 2.1.3 to 2.2.1:

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag : Error executing tag : java.lang.VerifyError: (class: com/troii/project/tags/SomeTag$Info, method: getSession signature: ()Ljavax/servlet/http/HttpSession;) Incompatible object argument for function call
	at com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag : Error executing tag : java.lang.VerifyError: (class: com/troii/project/tags/SomeTag$Info, method: getSession signature: ()Ljavax/servlet/http/HttpSession;) Incompatible object argument for function call

I had never seen a java.lang.VerifyError exception before and the second strange thing was that the exception only occured when deploying the war in a tomcat not when starting the app with grails run-app.

Read more →

Hibernate schema update does not create database indices

In one of my Grails consulting projects we tried to define database indices via the static mapping element in the domain classes. A team member tried it an told me that this does not work so I digged a bit deeper to find out what the problem was.

I created a simple test project, configured hbm2ddl auto to update, like I am used to and let Grails create a MySQL database schema. It seemed lie my colleague was right, the defined indices were not created (using Grails 1.3.7). Doing some web research brought up this Stackoverflow posting suggesting that indices are only created when hbm2ddl auto was set to create (or create-drop) - which seemed to be the case.

Read more →

Default naming strategies with Grails an plain Hibernate

Last year (damn so long ago? seems like last week) I wrote a post about naming strategies and reusing an existing Hibernate domain model in a Grails app. I stumbled across this because I created a Grails application that is used as a “back office” management application for our time tracking product timr.com the uses the existing Hibernate domain model classes from the Spring application. There has also been a blog post on the official Springsource blog about this where I made a comment.

Read more →