I’m trying to get a Project running on Tomcat7 that requires some Plugins and is written in Grails.
Creating a -war with the command grails prod war results in no Errors. But if i add the app to my Tomcat7server it dose not get executed.
The log file of my tomcat7 reviels that there must be something wrong with my ApplicationContext.xml.
2014-07-01 15:22:22,325 [http-bio-8080-exec-87] ERROR StackTrace - Full Stack Trace:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader';
nested exception is org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean]
for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
My ApplicationContext.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
<description>Grails application factory bean</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="grailsResourceLoader" ref="grailsResourceLoader" />
</bean>
<bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
<description>A bean that manages Grails plugins</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
<property name="application" ref="grailsApplication" />
</bean>
<bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
<constructor-arg>
<ref bean="grailsApplication" />
</constructor-arg>
<property name="pluginManager" ref="pluginManager" />
</bean>
<bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean">
<property name="grailsResourceHolder" ref="grailsResourceHolder" />
</bean>
<bean id="grailsResourceHolder" scope="prototype" class="org.codehaus.groovy.grails.commons.spring.GrailsResourceHolder">
<property name="resources">
<value>classpath*:**/grails-app/**/*.groovy</value>
</property>
</bean>
<bean id="characterEncodingFilter"
class="org.springframework.web.filter.CharacterEncodingFilter">
<property name="encoding">
<value>utf-8</value>
</property>
</bean>
</beans>
My research showed me that with the new Grails 2.4.0 some things have been deleted like the Holder stuff.
but now i dont know what to do with that Do I remove the lines ? Do I need to replace them or even delete them ?
Thanks in advance
Simply,
Remove grailsResourceLoader
bean reference (the line below) from applicationContext.xml
.
<property name="grailsResourceLoader" ref="grailsResourceLoader" />
and remove it from the property of grailsApplication
bean
and you will have:
<bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
<description>Grails application factory bean</description>
<property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
</bean>
See the section "Changes To applicationContext.xml" - http://grails.org/doc/2.4.x/guide/upgradingFrom23.html
Basically remove the reference of grailsResourceLoader and corresponding bean declaration form applicationContext.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With