1 Reply Latest reply on Mar 2, 2009 3:28 PM by Ales Justin

    <component scan fail while War deployment

    shaival satyarthi Newbie


      Hi,
      I am using autowired Beans with @AutoWired , @Component etc
      and my Application-context.xml has following entry.



      <context:component-scan base-package="com.interval.services.pojo.impl">
      <context:include-filter type="annotation" expression="org.springframework.beans.factory.annotation.Autowired"/>

      <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
      </context:component-scan>

      My WebWar deploys fine in Tomcat , jetty but when i use Jboss 5.0.1A.
      Deployment fails and it gives following error.If you can guide me a bit that will be really great.


      at java.lang.Thread.run(Thread.java:619)
      Caused by: org.springframework.beans.factory.BeanCreationException: Could not au
      towire field: private com.interval.services.pojo.ContactService com.interval.con
      tact.service.contactmanager.ContactManagerEndpoint.contactService; nested except
      ion is org.springframework.beans.factory.NoSuchBeanDefinitionException: No uniqu
      e bean of type [com.interval.services.pojo.ContactService] is defined: Unsatisfi
      ed dependency of type [interface com.interval.services.pojo.ContactService]: exp
      ected at least 1 matching bean
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
      ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
      ava:435)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject
      Fields(InjectionMetadata.java:105)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
      ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
      java:240)
      ... 78 more
      Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No u
      nique bean of type [com.interval.services.pojo.ContactService] is defined: Unsat
      isfied dependency of type [interface com.interval.services.pojo.ContactService]:
      expected at least 1 matching bean
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.
      resolveDependency(DefaultListableBeanFactory.java:613)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
      ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
      ava:412)
      ... 80 more
      15:07:00,708 ERROR [[/EnterpriseServicesWeb]] Servlet /EnterpriseServicesWeb thr
      ew load() exception
      org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean
      of type [com.interval.services.pojo.ContactService] is defined: Unsatisfied depe
      ndency of type [interface com.interval.services.pojo.ContactService]: expected a
      t least 1 matching bean
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.
      resolveDependency(DefaultListableBeanFactory.java:613)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
      ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
      ava:412)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject
      Fields(InjectionMetadata.java:105)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
      ostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.
      java:240)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBean
      Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
      ject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
      y.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
      an(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
      (AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.
      preInstantiateSingletons(DefaultListableBeanFactory.java:429)
      at org.springframework.context.support.AbstractApplicationContext.finish
      BeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refres
      h(AbstractApplicationContext.java:380)
      at org.springframework.web.servlet.FrameworkServlet.createWebApplication
      Context(FrameworkServlet.java:402)
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationCo
      ntext(FrameworkServlet.java:316)
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(Fram
      eworkServlet.java:282)
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.
      java:126)
      at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
      java:1048)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:95
      0)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
      t.java:4122)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
      421)
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy
      Internal(TomcatDeployment.java:312)
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy
      (TomcatDeployment.java:144)
      at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeploy
      ment.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(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
      er.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 $Proxy36.start(Unknown Source)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installActio
      n(StartStopLifecycleAction.java:42)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installActio
      n(StartStopLifecycleAction.java:37)
      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.sim
      pleInstallAction(SimpleControllerContextAction.java:62)
      at org.jboss.dependency.plugins.action.AccessControllerContextAction.ins
      tall(AccessControllerContextAction.java:71)
      at org.jboss.dependency.plugins.AbstractControllerContextActions.install