Exception while deploying to JBoss 7.1.1: Error creating bean with name 'pluginManager' defined in ServletContext resource

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Exception while deploying to JBoss 7.1.1: Error creating bean with name 'pluginManager' defined in ServletContext resource

happymathew
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I'm trying to implement module(JBoss) for my grails application, which is using Spring Security. Since the Spring Security and Grails are having large number of dependencies, the war size becomes more than 80MB. So, in order to avoid this, I'm trying to access these dependency from the module iin Jboss.

I getting the following error while deploying my Grails WAR file in Jboss-7.1.1.Final.

ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:687) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) [spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) [spring-web-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener.initWebApplicationContext(GrailsContextLoaderListener.java:71) [grails-web-2.4.4.jar:2.4.4]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]
Caused by: java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0]
        at java.lang.Class.forName(Class.java:264) [rt.jar:1.7.0]
        at org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean.afterPropertiesSet(GrailsPluginManagerFactoryBean.java:99) [grails-core-2.4.4.jar:2.4.4]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) [spring-beans-4.0.7.RELEASE.jar:4.0.7.RELEASE]
        ... 21 more
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'CacheGrailsPlugin$1@1fffd5d' with class 'CacheGrailsPlugin$1' to class 'javassist.util.proxy.ProxyFactory$ClassLoaderProvider'
        at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:392) [groovy-all-2.3.7.jar:2.3.7]
        at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:306) [groovy-all-2.3.7.jar:2.3.7]
        at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:227) [groovy-all-2.3.7.jar:2.3.7]
        at org.codehaus.groovy.reflection.CachedField.setProperty(CachedField.java:65) [groovy-all-2.3.7.jar:2.3.7]
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2626) [groovy-all-2.3.7.jar:2.3.7]
        at groovy.lang.ExpandoMetaClass.setProperty(ExpandoMetaClass.java:1170) [groovy-all-2.3.7.jar:2.3.7]
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3702) [groovy-all-2.3.7.jar:2.3.7]
        at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:193) [groovy-all-2.3.7.jar:2.3.7]
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:482) [groovy-all-2.3.7.jar:2.3.7]
        at CacheGrailsPlugin.<clinit>(CacheGrailsPlugin.groovy:36)

---------------------------------------------------------------------------------------------------------------------

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" />
    </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="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>

jboss-deployment-structure.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
    <deployment>
        <dependencies>     
            <module name="com.sits.grails">
                <imports>
                    <include path="META-INF**"/>
                    <include path="org**"/>
                </imports>
            </module>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.sits.grails">
    <properties>
        <property name="jboss.api" value="private"/>
    </properties>

    <resources>
        <resource-root path="activation-1.1.jar"/>
        <resource-root path="antlr-2.7.7.jar"/>
        .........
        .........
        <resource-root path="jboss-logging-3.1.0.GA.jar"/>
        <resource-root path="jboss-logging-annotations-1.2.0.Beta1.jar"/>
        <resource-root path="jboss-transaction-api_1.2_spec-1.0.0.Final.jar"/>
        <resource-root path="jcl-over-slf4j-1.7.5.jar"/>
        <resource-root path="jsr166y-1.7.0.jar"/>
        <resource-root path="jul-to-slf4j-1.7.5.jar"/>
        <resource-root path="liquibase-core-2.0.5.jar"/>
        <resource-root path="log4j-1.2.17.jar"/>
        <resource-root path="mysql-connector-java-5.1.13.jar"/>
        <resource-root path="netty-all-4.0.15.Final.jar"/>
        <resource-root path="rhino-1.7R4.jar"/>
        <resource-root path="serializer-2.7.1.jar"/>
        <resource-root path="sitemesh-2.4.jar"/>
        <resource-root path="slf4j-api-1.7.5.jar"/>
        <resource-root path="spring-aop-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-aspects-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-beans-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-context-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-context-support-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-core-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-expression-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-jdbc-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-orm-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-security-core-3.2.7.RELEASE.jar"/>
        <resource-root path="spring-security-web-3.2.7.RELEASE.jar"/>
        <resource-root path="spring-tx-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-web-4.0.7.RELEASE.jar"/>
        <resource-root path="spring-webmvc-4.0.7.RELEASE.jar"/>
        <resource-root path="tomcat-embed-logging-log4j-7.0.50.jar"/>
        <resource-root path="tomcat-jdbc-7.0.50.jar"/>
        <resource-root path="tomcat-juli-7.0.50.jar"/>
        <resource-root path="validation-api-1.1.0.Final.jar"/>       
    </resources>

    <dependencies>
       <module name="javax.api"/>
       <module name="sun.jdk"/>
       <module name="org.javassist" optional="true"/>
       <module name="javax.servlet.api"/>
       <module name="org.apache.commons.logging"/>     
    </dependencies>
</module>

In MANIFEST.MF file have the dependencies declared.

Dependencies: org.apache.log4j,com.sits.grails

I'm not understanding what causes this issue. If someone can help me to identify will be a great help. Thanks.