创建名为';grailsApplication';

创建名为';grailsApplication';,grails,Grails,GrailsV2.3.7 启动Grails应用程序时,出现以下错误: 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 Me

GrailsV2.3.7

启动Grails应用程序时,出现以下错误:

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>

Grails应用程序工厂bean
管理Grails插件的bean
utf-8

请彻底检查您在控制器内使用的控制器名称、程序包名称是否存在拼写错误

特别是控制器

复制

(将applicationContext.xml从2.4发行版复制到您的
grails应用程序)

当我在域类->类未找到中删除一些包目录加载grails应用程序时,我也发现了相同的异常


出现异常的原因是在某个文件中导入了错误的包。

创建一个简单的Gradle项目。 打开build.gradle文件。 确保Gradle、Grails和Groovy插件版本彼此兼容。 从Gradle Grails插件网站复制build.Gradle示例的内容,并将其粘贴到IDE中打开的构建文件中。 在渐变工具窗口中,单击刷新图标以刷新渐变项目。 Grails任务列表将添加到Gradle工具窗口中的“所有任务”区域。 从“所有任务”列表中,运行init task。 该任务创建一个Grails应用程序。Grails视图工具窗口变为可用,您可以开始使用Grails。 有关使用Grails的更多信息,请参见Grails过程


我假设您正在尝试访问某个地方的
conf.ApplicationResources
。这就是破坏它的原因。是的。请告诉我如何配置它。如果不发布任何源代码,我不知道你在做什么。尽管有堆栈跟踪帖子,请显示你对mongo db和grails的配置?您的grails在mongodb之前运行过吗?可能的答案是: