0 Replies Latest reply on Oct 18, 2011 10:04 AM by Sam W

    Autowired failed

    Sam W Expert

      Hello,

       

      When I deploy an EAR file which consists of spring 3.0.5 to JBOSS 7.1A2, JBOSS throws the following error:

       

       

      10:53:27,754 INFO  [stdout] (MSC service thread 1-6) Oct 18 2011 23:53:27 ERROR org.springframework.web.context.ContextLoader - Context initialization failed

      10:53:27,754 INFO  [stdout] (MSC service thread 1-6) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected ix.houseware.category.dao.PersonDao ix.houseware.category.web.servlet.mvc.PersonController.personDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

      10:53:27,754 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,754 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,754 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [org.springframework.context-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [org.springframework.context-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [org.springframework.web-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [org.springframework.web-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.0.6.RELEASE.jar:na]

      10:53:27,755 INFO  [stdout] (MSC service thread 1-6)    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.2.Final.jar!/:7.1.0.Alpha2-SNAPSHOT]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3845) [jbossweb-7.0.2.Final.jar!/:7.1.0.Alpha2-SNAPSHOT]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:81) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar!/:7.1.0.Alpha2-SNAPSHOT]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar!/:1.0.1.GA]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar!/:1.0.1.GA]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [na:1.6.0_07]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [na:1.6.0_07]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_07]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6) Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected ix.houseware.category.dao.PersonDao ix.houseware.category.web.servlet.mvc.PersonController.personDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,756 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    ... 21 common frames omitted

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480) [org.springframework.beans-3.0.6.RELEASE.jar:na]

      10:53:27,757 INFO  [stdout] (MSC service thread 1-6)    ... 23 common frames omitted

      10:53:27,757 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/CategoryClient5-web]] (MSC service thread 1-6) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected ix.houseware.category.dao.PersonDao ix.houseware.category.web.servlet.mvc.PersonController.personDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [org.springframework.context-3.0.6.RELEASE.jar:]

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [org.springframework.context-3.0.6.RELEASE.jar:]

              at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [org.springframework.web-3.0.6.RELEASE.jar:]

              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [org.springframework.web-3.0.6.RELEASE.jar:]

              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [org.springframework.web-3.0.6.RELEASE.jar:]

              at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]

              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3845) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]

              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:81) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [:1.6.0_07]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [:1.6.0_07]

              at java.lang.Thread.run(Thread.java:619) [:1.6.0_07]

      Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected ix.houseware.category.dao.PersonDao ix.houseware.category.web.servlet.mvc.PersonController.personDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) [org.springframework.beans-3.0.6.RELEASE.jar:]

              ... 21 more

      Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ix.houseware.category.dao.PersonDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) [org.springframework.beans-3.0.6.RELEASE.jar:]

              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480) [org.springframework.beans-3.0.6.RELEASE.jar:]

              ... 23 more

       

       

      10:53:27,761 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-6) Error listenerStart

      10:53:27,761 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-6) Context [/CategoryClient5-web] startup failed due to previous errors

      10:53:27,771 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/CategoryClient5-web]] (MSC service thread 1-6) Closing Spring root WebApplicationContext

      10:53:27,773 INFO  [org.jboss.web] (MSC service thread 1-6) registering web context: /CategoryClient5-web

      10:53:27,787 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "CategoryClient5-ear.ear"

       

       

       

      I have searched google for the whole day , I am still unable to found something that can resolve this problem.

       

      I have attached my sample project here for reference.

       

      Any suggestion would be very appreciated.

       

      Thanks

      Sam