![](/img/trans.png)
[英]org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'leadDAO' is defined
[英]org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'documentumServiceForIDP' is defined
我有一个场景,我们在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**
我在这上苦苦挣扎了几天,但没有找到解决方案。 请帮我,如果通过这个问题了人前。
但是我意识到在调试时,一个应用程序bean的定义会覆盖另一个。
不知道你看到了什么,而调试,但根据您所提供的,你有两个独立的BeanFactory日志:
DefaultListableBeanFactory @ 8478d0它结合bean定义从
DefaultListableBeanFactory @ 1632823,它将来自
我假设你有两个Web应用程序(一个在每个耳朵),他们都设置应用程序上下文。
您的问题似乎与第二种情况有关:
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.xml
和SecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml
RedeliveryPolicy
(bean名称RedeliveryPolicy
): IDP.ear/IDPEJB.jar!/META-INF/applicationContext.xml
和SecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml
JtaTransactionManager
(bean名字transactionManager
),在这两个定义: RedeliveryPolicy
(bean名称RedeliveryPolicy
): IDP.ear/IDPEJB.jar!/META-INF/applicationContext.xml
和SecureClaim.ear/SipsMessaging.jar!/META-INF/applicationContext.xml
你必须确保你需要包括所有这一切的applicationContext.xml文件。 如果是这样的话(我真怀疑,但仍然),你应该给你的豆子不同的名称。
为了更好地理解正在发生的事情,你可以发表你的web.xml这里既Web应用程序?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.