@Property annotation removed

Generated code in Grails used to use an @Property annotation to indicate Grails properties. This was used somewhere around version 0.1 – 0.2, was still supported in 0.3.1 (although I think not used in newly generated code), but is now no longer in 0.4.2. You’ll see the error:

<code>
 @ line 8, column 6.ExampleController: 34: unable to resolve class Property unable
to find class for annotation
</code>

Just go through your old code if you have migrated from prior versions of Grails and replace the @Property annotation with def instead – the code will work with 0.4.2+.

Using pagination with Controller action other than the default list

By default ‘list’ pages are generated to use the <paginate> tag, and this invokes the list action to retrieve the next set of results.

If you are using an action other than the default list action, include the action="" attribute on the tag to use an alternative action method:

<code>&lt;g:paginate action="${listType}" total="${Purchase.count()}" /&gt;</code>

In the above example the action method is the result of a value set from the previous action method to indicate which action method is to be used.

Creating a deployable WAR file

When running ‘grails’ from the command line, the list of available targets does not list the target for creating a deployable WAR file.

‘grails war’ creates a packaged WAR file that can be deployed to a servlet container.

NoSuchMethodErrror StringUtils.isBlank() when deploying Grails WAR to JBoss 4.0.1

Deploying a Grails 0.1 WAR to JBoss 4.0.1 I get this exception:

<code>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined
in ServletContext resource [/WEB-INF/applicationContext.xml]: 
Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: 
org.apache.commons.lang.StringUtils.isBlank(Ljava/lang/String;)Z
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:370)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
	org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
	org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
	org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
	javax.servlet.GenericServlet.init(GenericServlet.java:211)
</code>

This seems to be a Commons Lang jar issue, and does not occur if deploying Grails web apps to JBoss 4.0.4+

Update: This is an issue with the JBoss Unified ClassLoader when deploying to a JBoss server with other webapps including other possibly different versions of the same jars. The solution is to disable the Unified ClassLoader.

Disabling the use of the JBoss Unified Class Loader in this file:

/jboss/server/default/deploy/jbossweb-tomcat50.sar/jboss-service.xml

changing this line:

<code>
&lt;attribute name="UseJBossWebLoader"&gt;true&lt;/attribute&gt;
</code>

to

<code>
&lt;attribute name="UseJBossWebLoader"&gt;false&lt;/attribute&gt;
</code>