您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> Java >> Spring root of factory hierarchy 问题

Spring root of factory hierarchy 问题

来源:网络整理     时间:2016/7/25 4:41:17     关键词:

关于网友提出的“ Spring root of factory hierarchy 问题”问题疑问,本网通过在网上对“ Spring root of factory hierarchy 问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: Spring root of factory hierarchy 问题
描述:

日志
2011-01-07 10:20:27 INFO org.springframework.web.context.support.XmlWebApplicationContext.doClose(815) | Closing org.springframework.web.context.support.XmlWebApplicationContext@18aea9e: display name [Root WebApplicationContext]; startup date [Mon Dec 27 13:03:57 CST 2010]; root of context hierarchy
2011-01-07 10:20:27 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(421) | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1a8f100: defining beans [dataSourceCmp,sqlMapClient,sqlMapClientTemplate,jdbcTemplate,tmpQualityEntInfoDAO,curQualityEntInfoDAO,tmpRasEntBaseDAO,rasMessStatDAO,tmpRasCertOperInfoDAO,tmpBusinessCertInfoDAO,tmpLicenceInfoDAO,rasLoginInfoDAO,tmpRasRelPerDAO,rasCertStatDAO,oracleSequenceDao,tmpDrugEntInfoDAO,curRasEntBaseDAO,chinaUnitCodeInfoDAO,drugAdminCodeInfoDAO,rasUnlockApplyDAO,rasIcCertDAO,curDrugEntInfDAO,curRasRelPerDAO,curBusinessCertInfoDAO,curLicenceinfoDAO,curGovOrgInfoDAO,rasUnlockApplyHisDAO,rasOrderInfoDAO,curRasCertOperInfoDAO,qualAdminCodeInfoDAO,agriTradeInfoDAO,paraTableDAO,rasMessRecordDAO,rasMessRecordHisDAO,getMesContent,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,EnterpriseRegService,AjaxService,userCourseManager,applyOpenLockManager,unlockManager,orderViewManager,chinaUnitCodeManage,paraTableManager,sendMessManager,rasMessRecordHisManager]; root of factory hierarchy
2011-01-07 10:21:40 INFO org.springframework.web.context.ContextLoader.initWebApplicationContext(189) | Root WebApplicationContext: initialization started
2011-01-07 10:21:41 INFO org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh(411) | Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1d18184: display name [Root WebApplicationContext]; startup date [Fri Jan 07 10:21:41 CST 2011]; root of context hierarchy
2011-01-07 10:21:41 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(323) | Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext-ibatis.xml]
2011-01-07 10:21:41 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(323) | Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext-resources.xml]
2011-01-07 10:21:42 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(323) | Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext-service.xml]
2011-01-07 10:21:42 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(323) | Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext-resources.xml]
2011-01-07 10:21:42 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition(467) | Overriding bean definition for bean 'dataSourceCmp': replacing [Generic bean: class [org.apache.commons.dbcp.BasicDataSource]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=close; defined in ServletContext resource [/WEB-INF/classes/applicationContext-resources.xml]] with [Generic bean: class [org.apache.commons.dbcp.BasicDataSource]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=close; defined in ServletContext resource [/WEB-INF/classes/applicationContext-resources.xml]]
2011-01-07 10:21:42 INFO org.springframework.web.context.support.XmlWebApplicationContext.obtainFreshBeanFactory(426) | Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1d18184]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1598501
2011-01-07 10:21:43 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(414) | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1598501: defining beans [dataSourceCmp,sqlMapClient,sqlMapClientTemplate,jdbcTemplate,tmpQualityEntInfoDAO,curQualityEntInfoDAO,tmpRasEntBaseDAO,rasMessStatDAO,tmpRasCertOperInfoDAO,tmpBusinessCertInfoDAO,tmpLicenceInfoDAO,rasLoginInfoDAO,tmpRasRelPerDAO,rasCertStatDAO,oracleSequenceDao,tmpDrugEntInfoDAO,curRasEntBaseDAO,chinaUnitCodeInfoDAO,drugAdminCodeInfoDAO,rasUnlockApplyDAO,rasIcCertDAO,curDrugEntInfDAO,curRasRelPerDAO,curBusinessCertInfoDAO,curLicenceinfoDAO,curGovOrgInfoDAO,rasUnlockApplyHisDAO,rasOrderInfoDAO,curRasCertOperInfoDAO,qualAdminCodeInfoDAO,agriTradeInfoDAO,paraTableDAO,rasMessRecordDAO,rasMessRecordHisDAO,getMesContent,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,EnterpriseRegService,AjaxService,userCourseManager,applyOpenLockManager,unlockManager,orderViewManager,chinaUnitCodeManage,paraTableManager,sendMessManager,rasMessRecordHisManager,copCodeFactory]; root of factory hierarchy
2011-01-07 10:21:44 INFO org.springframework.web.context.ContextLoader.initWebApplicationContext(209) | Root WebApplicationContext: initialization completed in 3642 ms



2011-01-07 10:26:37 INFO org.springframework.context.support.ClassPathXmlApplicationContext.prepareRefresh(411) | Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@10080b5: display name [org.springframework.context.support.ClassPathXmlApplicationContext@10080b5]; startup date [Fri Jan 07 10:26:37 CST 2011]; root of context hierarchy
2011-01-07 10:26:37 INFO org.springframework.context.support.ClassPathXmlApplicationContext.obtainFreshBeanFactory(426) | Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@10080b5]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1efb1
2011-01-07 10:26:37 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(414) | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1efb1: defining beans []; root of factory hierarchy
2011-01-07 10:26:37 ERROR com.piats.user.common.webapp.action.ActionExceptionHandler.logException(134) | org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'copCodeFactory' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:387)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:971)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246)
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.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:880)
at com.piats.user.util.copcodetool.CopCodeGenerator.<init>(CopCodeGenerator.java:23)
at com.piats.user.util.copcodetool.CopCodeGenerator.getInstance(CopCodeGenerator.java:28)
java


private CopCodeGenerator() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
"applicationContext*.xml");
copCodeFactory = (CopCodeFactory) ctx.getBean("copCodeFactory");
}
public static CopCodeGenerator getInstance() {
if (copCodeGenerator == null) {
copCodeGenerator = new CopCodeGenerator();
}
return copCodeGenerator;
}

配置文件
<bean id="copCodeFactory" class="com.piats.user.util.copcodetool.CopCodeFactory">
<property name="oracleSequenceDao" ref="oracleSequenceDao"/>
<property name="preTypeForProduce">
<value>F</value>
</property>
</bean>
在本机运行没有任何问题
部署到weblogic  就会有问题。
我想是应为 spring是单例、在应用启动时候加载了配置文件、然后在调用到代码时又加载了配置文件引起的?
但是在本机是不会有这错误的。 迷惑,请求帮助


解决方案1:

真正的异常是这个No bean named 'copCodeFactory' is defined
要看下部署到weblogic之后包含copCodeFactory定义的配置文件在哪,是否能够被你的程序找到。


以上介绍了“ Spring root of factory hierarchy 问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2903793.html

相关图片

相关文章