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>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.