0

Grails v2.3.7

When starting my Grails application I am getting the following error:

Error creating bean with name 'grailsApplication' defined in ServletContext

Stacktrace

Error |
    2014-04-23 13:51:13,856 [localhost-startStop-1] ERROR context.ContextLoader  - Context initialization failed
    Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: conf.ApplicationResources
        Line | Method
    ->>  262 | run       in java.util.concurrent.FutureTask
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Caused by GrailsConfigurationException: Class not found loading Grails application: conf.ApplicationResources
    ->>  262 | run       in java.util.concurrent.FutureTask
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Caused by ClassNotFoundException: conf.ApplicationResources
    ->>  366 | run       in java.net.URLClassLoader$1
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |    355 | run       in     ''
    |    354 | findClass in java.net.URLClassLoader
    |    425 | loadClass in java.lang.ClassLoader
    |    262 | run . . . in java.util.concurrent.FutureTask
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Error |
    2014-04-23 13:51:14,606 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: conf.ApplicationResources
    Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: conf.ApplicationResources
        Line | Method
    ->>  262 | run       in java.util.concurrent.FutureTask
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Caused by GrailsConfigurationException: Class not found loading Grails application: conf.ApplicationResources
    ->>  262 | run       in java.util.concurrent.FutureTask
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Caused by ClassNotFoundException: conf.ApplicationResources
    ->>  366 | run       in java.net.URLClassLoader$1
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |    355 | run       in     ''
    |    354 | findClass in java.net.URLClassLoader
    |    425 | loadClass in java.lang.ClassLoader
    |    262 | run . . . in java.util.concurrent.FutureTask
    |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
    |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
    ^    744 | run       in java.lang.Thread
    Error |
Forked Grails VM exited with error

applicationContext.xml

<?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.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" />

    <bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
        <property name="encoding">
            <value>utf-8</value>
        </property>
    </bean>

    <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean" />
</beans>
Tyler Rafferty
  • 3,391
  • 4
  • 28
  • 37
user1707942
  • 15
  • 2
  • 9

4 Answers4

1

Please , entirely check that you have no spell errors on controller names , package names that you have used inside controllers .

Specially controller.

Develop4Life
  • 7,581
  • 8
  • 58
  • 76
0

Duplicate with Grails ApplicationContext.xml grailsResourceLoader

https://groups.google.com/forum/#!forum/grails-dev-discuss.

(copy over the applicationContext.xml from the 2.4 distro into your grails app)

Community
  • 1
  • 1
biniam
  • 8,099
  • 9
  • 49
  • 58
0

I have also found the same exception When i have remove some package directory in my domain class -> Class not found loading Grails application

The reason for the Exception was that wrong package imported in some file.

R Tiwari
  • 325
  • 3
  • 9
0

Create a simple Gradle project. Open build.gradle file. Make sure that the Gradle, Grails and Groovy plugin versions are compatible between each other. From the Gradle-Grails plugin Website copy the content of the build.gradle example and paste it to the opened build file inside your IDE. In the Gradle tool window, click refresh icon to refresh your Gradle project. The list of Grails tasks are added to the All tasks area in the Gradle Tool Window. From the All tasks list, run init task. The task creates a Grails application. The Grails View tool window becomes available and you can start working with Grails. For more information on working with Grails, see Grails procedures.

https://www.jetbrains.com/idea/help/creating-gradle-project-with-grails-integration.html

Alex Shwarc
  • 822
  • 10
  • 20