Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean with name 'grailsApplication' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error creating bean with name 'grailsApplication'

    Hello, I am getting the following error when starting my grails project on a Tomcat6 or jetty server. Can you help me?

    Code:
    20.08.2011 03:31:20 org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    2011-08-20 03:31:22,488 [http-8080-2] ERROR context.ContextLoader  - Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
    	at java.lang.Thread.run(Thread.java:636)
    Caused by: java.lang.ExceptionInInitializerError
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:264)
    	... 1 more
    Caused by: java.lang.reflect.MalformedParameterizedTypeException
    	at java.lang.Class.getGenericSuperclass(Class.java:694)
    	at com.sun.beans.TypeResolver.prepare(TypeResolver.java:274)
    	at com.sun.beans.TypeResolver.<init>(TypeResolver.java:243)
    	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:172)
    	at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:93)
    	at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:385)
    	at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116)
    	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:74)
    	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:58)
    	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1196)
    	at java.beans.Introspector.getBeanInfo(Introspector.java:423)
    	at java.beans.Introspector.getBeanInfo(Introspector.java:189)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at grails.plugins.springsecurity.SecurityTagLib$__clinit__closure13.<init>(SecurityTagLib.groovy)
    	at grails.plugins.springsecurity.SecurityTagLib.<clinit>(SecurityTagLib.groovy)
    	... 3 more
    20.08.2011 03:31:22 org.apache.catalina.core.StandardContext listenerStart
    SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
    	at java.lang.Thread.run(Thread.java:636)
    Caused by: java.lang.ExceptionInInitializerError
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Class.java:264)
    	... 1 more
    Caused by: java.lang.reflect.MalformedParameterizedTypeException
    	at java.lang.Class.getGenericSuperclass(Class.java:694)
    	at com.sun.beans.TypeResolver.prepare(TypeResolver.java:274)
    	at com.sun.beans.TypeResolver.<init>(TypeResolver.java:243)
    	at com.sun.beans.TypeResolver.resolve(TypeResolver.java:172)
    	at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:93)
    	at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:385)
    	at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116)
    	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:74)
    	at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:58)
    	at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1196)
    	at java.beans.Introspector.getBeanInfo(Introspector.java:423)
    	at java.beans.Introspector.getBeanInfo(Introspector.java:189)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at grails.plugins.springsecurity.SecurityTagLib$__clinit__closure13.<init>(SecurityTagLib.groovy)
    	at grails.plugins.springsecurity.SecurityTagLib.<clinit>(SecurityTagLib.groovy)
    	... 3 more
    20.08.2011 03:31:22 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Error listenerStart
    20.08.2011 03:31:22 org.apache.catalina.core.StandardContext start
    SCHWERWIEGEND: Context [/gotcha-0.1] startup failed due to previous errors
    20.08.2011 03:31:22 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    SCHWERWIEGEND: A web application created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal@131cd12]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
    This is the mentioned .xml in the error log: WEB-INF/applicationContext.xml


    Code:
    <?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>**/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>
    Last edited by wasserfall; Aug 20th, 2011, 06:36 PM.

  • #2
    The package myBean should be located in 'ROOT->WEB-INF->classes' folder. The JSP file should be in the ROOT folder. The directory structure should look like this:Free Online Books

    Comment

    Working...
    X