Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.beans.factory.BeanNotOfRequire dTypeException error after upgrade Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.beans.factory.BeanNotOfRequire dTypeException error after upgrade

    I have an working web app using Spring running inside of JBoss via JBoss deployer. After upgrading the spring framework from 2.5.6 to 3.2.2 I am getting an org.springframework.beans.factory.BeanNotOfRequire dTypeException when loading the context. Can anyone provide some advice on what the underlying issue may be?

    Full traceback:
    Code:
    2013-03-20 15:46:07,549 INFO  <main> [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/mccadminui]:296] Initializing Spring root WebApplicationContext
    2013-03-20 15:46:07,549 INFO  <main> [org.springframework.web.context.ContextLoader:273] Root WebApplicationContext: initialization started
    2013-03-20 15:46:07,634 INFO  <main> [org.springframework.context.support.ClassPathXmlApplicationContext:510] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@75b31e45: startup date [Wed Mar 20 15:46:07 EDT 2013]; root of context hierarchy
    2013-03-20 15:46:07,722 INFO  <main> [org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315] Loading XML bean definitions from URL [vfszip:/D:/jboss-5.1.0.GA/server/mcc/deploy/mcc-services-2013.1.1-SNAPSHOT-deploy.jar/parentContextDefinition.xml]
    2013-03-20 15:46:07,813 INFO  <main> [org.springframework.beans.factory.support.DefaultListableBeanFactory:596] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3674318d: defining beans [mccServiceContext]; root of factory hierarchy
    2013-03-20 15:46:07,901 ERROR <main> [org.springframework.web.context.ContextLoader:319] Context initialization failed
    org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [mccServiceContext], from group with resource name [classpath*:parentContextDefinition.xml]; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'mccServiceContext' must be of type [org.springframework.beans.factory.BeanFactory], but was actually of type [org.jboss.spring.factory.NamedXmlApplicationContext]
        at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:402)
        at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:538)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
        at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
        at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
        at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
        at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
        at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
        at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
        at $Proxy38.start(Unknown Source)
    ...
    Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'mccServiceContext' must be of type [org.springframework.beans.factory.BeanFactory], but was actually of type [org.jboss.spring.factory.NamedXmlApplicationContext]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:361)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121)
        at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394)
        ... 72 more
    Here are the config settings:

    jboss-spring.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.xsd" >
    
     <description>BeanFactory=(mcc-services)</description>
    
     <import resource="classpath:com/_8020/mcc/resources/mcc-resources.xml"/>
     <import resource="classpath:com/_8020/mcc/service/mcc-service.xml"/>
     <import resource="classpath:com/_8020/mcc/eventlisteners/mcc-eventlisteners.xml" />
    
    </beans>
    parentContextDefinition.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"
      xmlns:jee="http://www.springframework.org/schema/jee"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      	http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd" >
    
     <jee:jndi-lookup jndi-name="mcc-services" id="mccServiceContext" />
    
    </beans>
    web.xml
    Code:
     <context-param>
       <param-name>contextClass</param-name>
       <param-value>org.springframework.web.context.support.XmlWebApplicationContext</param-value>
     </context-param>
    
     <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>
           /WEB-INF/applicationContext-*.xml
       </param-value>
     </context-param> 
    
     <context-param>
       <param-name>locatorFactorySelector</param-name>
       <param-value>parentContextDefinition.xml</param-value>
     </context-param> 
    
     <context-param>
       <param-name>parentContextKey</param-name>
       <param-value>mccServiceContext</param-value>
     </context-param>
Working...
X