org.springframework.beans.factory.NoSuchBeanDefinitionException:没有定义名为'documentumServiceForIDP'的bean

时间:2010-07-08 16:13:19

标签: java spring jboss

我有一个场景,我们在JBoss4.2.3上部署了两个EAR。每个Ear都有自己定义的applicationContext。但我意识到在调试时,一个应用程序bean定义会覆盖另一个。

这是服务器日志:

  

09:23:23,962 INFO 
> [XmlWebApplicationContext] Refreshing
> org.springframework.web.context.support.XmlWebApplicationContext@1b4aee4:
> display name [Root
> WebApplicationContext]; startup date
> [Thu Jul 08 09:23:23 MDT 2010]; root
> of context hierarchy 09:23:24,103 INFO
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from ServletContext
> resource
> [/WEB-INF/applicationContext-idp.xml]
> 09:23:24,166 INFO 
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp608645178333044413IDP.ear-contents/IDPEJB.jar!/META-INF/applicationContext.xml]
> 09:23:24,181 INFO 
> [XmlWebApplicationContext] Bean
> factory for application context
> [org.springframework.web.context.support.XmlWebApplicationContext@1b4aee4]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory@8478d0
> 09:23:24,384 INFO 
> [DefaultListableBeanFactory]
> Pre-instantiating singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@8478d0:
> defining beans
> [**powersuiteServiceFactory,url,qname,powersuiteService,IDPDocumentumServiceFactory,documentumServiceForIDP,applicationUserName,IDPApplicationContextProvider,idpdctmfactory,externalService,brokerIp,jmsConnectionFactory,redeliveryPolicy,jmsDestination,IDPjmsTemplate,jmsProducer,jmsListener,transactionManager,IDPJmsContainer**];
> root of factory hierarchy
> 
> [[/SecureClaim]] Initializing Spring
> root WebApplicationContext
> 09:23:45,260 INFO  [ContextLoader]
> Root WebApplicationContext:
> initialization started 09:23:45,275
> INFO  [XmlWebApplicationContext]
> Refreshing
> org.springframework.web.context.support.XmlWebApplicationContext@1fbf66c:
> display name [Root
> WebApplicationContext]; startup date
> [Thu Jul 08 09:23:45 MDT 2010]; root
> of context hierarchy 09:23:45,275 INFO
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from ServletContext
> resource
> [/WEB-INF/applicationContext.xml]
> 09:23:45,291 INFO 
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp608645178333044413IDP.ear-contents/IDPEJB.jar!/META-INF/applicationContext.xml]
> 09:23:45,306 INFO 
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsFacelet.jar!/META-INF/applicationContext.xml]
> 09:23:45,322 INFO 
> [DefaultListableBeanFactory]
> Overriding bean definition for bean
> 'applicationContextProvider':
> replacing [Generic bean: class
> [org.idahosif.sips.common.spring.ApplicationContextProvider];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in
> ServletContext resource
> [/WEB-INF/applicationContext.xml]]
> with [Generic bean: class
> [org.idahosif.sips.common.spring.ApplicationContextProvider];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsFacelet.jar!/META-INF/applicationContext.xml]]
> 09:23:45,322 INFO 
> [XmlBeanDefinitionReader] Loading XML
> bean definitions from URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsMessaging.jar!/META-INF/applicationContext.xml]
> 09:23:45,322 INFO 
> [DefaultListableBeanFactory]
> Overriding bean definition for bean
> 'brokerIp': replacing [Generic bean:
> class
> [org.apache.activemq.ActiveMQConnectionFactory];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp608645178333044413IDP.ear-contents/IDPEJB.jar!/META-INF/applicationContext.xml]]
> with [Generic bean: class
> [org.apache.activemq.ActiveMQConnectionFactory];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsMessaging.jar!/META-INF/applicationContext.xml]]
> 09:23:45,322 INFO 
> [DefaultListableBeanFactory]
> Overriding bean definition for bean
> 'redeliveryPolicy': replacing [Generic
> bean: class
> [org.apache.activemq.RedeliveryPolicy];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp608645178333044413IDP.ear-contents/IDPEJB.jar!/META-INF/applicationContext.xml]]
> with [Generic bean: class
> [org.apache.activemq.RedeliveryPolicy];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsMessaging.jar!/META-INF/applicationContext.xml]]
> 09:23:45,338 INFO 
> [DefaultListableBeanFactory]
> Overriding bean definition for bean
> 'transactionManager': replacing
> [Generic bean: class
> [org.springframework.transaction.jta.JtaTransactionManager];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp608645178333044413IDP.ear-contents/IDPEJB.jar!/META-INF/applicationContext.xml]]
> with [Generic bean: class
> [org.springframework.transaction.jta.JtaTransactionManager];
> scope=singleton; abstract=false;
> lazyInit=false; autowireMode=0;
> dependencyCheck=0;
> autowireCandidate=true; primary=false;
> factoryBeanName=null;
> factoryMethodName=null;
> initMethodName=null;
> destroyMethodName=null; defined in URL
> [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7456914759893588436SecureClaim.ear-contents/SipsMessaging.jar!/META-INF/applicationContext.xml]]
> 09:23:45,338 INFO 
> [XmlWebApplicationContext] Bean
> factory for application context
> [org.springframework.web.context.support.XmlWebApplicationContext@1fbf66c]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory@1632823
> 09:23:45,494 INFO 
> [DefaultListableBeanFactory]
> Pre-instantiating singletons in
> org.springframework.beans.factory.support.DefaultListableBeanFactory@1632823:
> defining beans
> [**powersuiteServiceFactory,url,qname,powersuiteService,documentumServiceFactory,documentumRepository,applicationContextProvider,brokerIp,jmsConnectionFactory,redeliveryPolicy,jmsDestination,IDPjmsTemplate,jmsProducer,jmsListener,transactionManager,IDPJmsContainer,externalServiceFactory,configProperties,externalServiceForIndex,appExternalVarForCAP,processVariables,connectionFactory,destination,jmsTemplate,jmsSender,messageListener,jmsContainer**];
> root of factory hierarchy**

我在这方面挣扎了好几天,但我找不到解决办法。如果有人以前经历过这个问题,请帮助我。

1 个答案:

答案 0 :(得分:1)

  

但是我在调​​试时意识到,一个应用程序bean定义覆盖了另一个。

不确定在调试时看到了什么,但根据您提供的日志,您有两个单独的BeanFactories:

  • DefaultListableBeanFactory @ 8478d0,它结合了来自

    的bean定义
    • /WEB-INF/applicationContext-idp.xml
    • IDPEJB.jar!/META-INF/applicationContext.xml
  • DefaultListableBeanFactory @ 1632823,它结合了来自

    的bean定义
    • /WEB-INF/applicationContext.xml的
    • IDP.ear / IDPEJB.jar!/META-INF/applicationContext.xml
    • SecureClaim.ear / SipsFacelet.jar!/META-INF/applicationContext.xml

我假设你有两个网络应用程序(每个耳朵一个),它们都设置应用程序上下文。

你的问题似乎与第二个背景有关:

  • ApplicationContextProvider(bean名称applicationContextProvider)同时定义:SecureClaim.ear/SipsFacelet.jar!/META-INF/applicationContext.xml/WEB-INF/applicationContext.xml
  • ActiveMQConnectionFactory(bean名称brokerIp)同时定义:IDP.ear/IDPEJB.jar!/META-INF/applicationContext.xmlSecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml
  • RedeliveryPolicy(bean名称RedeliveryPolicy)同时定义:IDP.ear/IDPEJB.jar!/META-INF/applicationContext.xmlSecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml
  • JtaTransactionManager(bean name transactionManager)定义于:
  • RedeliveryPolicy(bean名称RedeliveryPolicy)同时定义:IDP.ear/IDPEJB.jar!/META-INF/applicationContext.xmlSecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml

您必须确保需要包含所有这些applicationContext.xml文件。如果是这种情况(我真的怀疑,但仍然),你应该给你的豆子不同的名字。

为了更好地了解发生了什么,您可以在这里发布两个网络应用的web.xml吗?