织梦CMS - 轻松建站从此开始!

猿梦网

当前位置: 主页 > 问答 >

Error creating bean with name '***' defined in ServletContex

时间:2020-05-04 19:11来源:猿梦网 作者:猿梦网 点击:
Error creating bean with name '***' defined in ServletContext resource 解决办法
广告位API接口通信错误,查看德得广告获取帮助
Error creating bean with name '***' defined in ServletContext resource
解决办法如下:
 
大家看看applicationContext.xml中的配置如下:
 
<bean id="FacebookVoteRecordDAO" class="hk.egame.web.dao.FacebookVoteRecordDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>                                                  
 <bean id="FacebookVoteSubjectDAO" class="hk.egame.web.dao.FacebookVoteSubjectDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>
 <bean id="FacebookVoteTitleDAO" class="hk.egame.web.dao.FacebookVoteTitleDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>
 
 <bean id="FacebookVoteMgr" class="hk.egame.facebook.service.FacebookVoteMgr">
  <property name="facebookVoteRecordDAO"><ref local="FacebookVoteRecordDAO" /></property>
  <property name="facebookVoteSubjectDao"><ref local="FacebookVoteSubjectDAO" /></property>
  <property name="facebookVoteTitleDAO"><ref local="FacebookVoteTitleDAO" /></property>
 </bean>
 <bean name="/facebook/vote" class="hk.egame.facebook.action.FacebookVoteAction">
  <property name="facebookVoteMgr"><ref bean="FacebookVoteMgr" /></property>
 </bean>
 
而FacebookVoteMgr.java中:
 
private FacebookVoteRecordDAO facebookVoteRecordDAO;
 
 private FacebookVoteSubjectDAO facebookVoteSubjectDao;
 
 private FacebookVoteTitleDAO facebookVoteTitleDao;
 
 public void setFacebookVoteRecordDAO(FacebookVoteRecordDAO facebookVoteRecordDAO) {
  this.facebookVoteRecordDAO = facebookVoteRecordDAO;
 }
 public void setFacebookVoteSubjectDao(FacebookVoteSubjectDAO facebookVoteSubjectDao) {
  this.facebookVoteSubjectDao = facebookVoteSubjectDao;
 }
 public void setFacebookVoteTitleDao(FacebookVoteTitleDAO facebookVoteTitleDao) {
  this.facebookVoteTitleDao = facebookVoteTitleDao;
 }
 
applicationContext.xml中的正确配置:
 
<bean id="FacebookVoteRecordDAO" class="hk.egame.web.dao.FacebookVoteRecordDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>                                                  
 <bean id="FacebookVoteSubjectDAO" class="hk.egame.web.dao.FacebookVoteSubjectDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>
 <bean id="FacebookVoteTitleDAO" class="hk.egame.web.dao.FacebookVoteTitleDAO">
  <property name="sessionFactory"><ref bean="sessionFactory" /></property>
 </bean>
 
 <bean id="FacebookVoteMgr" class="hk.egame.facebook.service.FacebookVoteMgr">
  <property name="facebookVoteRecordDAO"><ref local="FacebookVoteRecordDAO" /></property>
  <property name="facebookVoteSubjectDao"><ref local="FacebookVoteSubjectDAO" /></property>
  <property name="facebookVoteTitleDao"><ref local="FacebookVoteTitleDAO" /></property>
 </bean>
 <bean name="/facebook/vote" class="hk.egame.facebook.action.FacebookVoteAction">
  <property name="facebookVoteMgr"><ref bean="FacebookVoteMgr" /></property>
 </bean>
 
结论如下:
 
applicationContext.xml中bean的property的name必须和set方法注入时的名字完全相同,包括大小写。
 
报错内容如下:
 
[08:51:42.546] {main} org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'FacebookVoteMgr' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'facebookVoteTitleDAO' of bean class [hk.egame.facebook.service.FacebookVoteMgr]: No property 'facebookVoteTitleDAO' found
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
[08:51:42.546] {main}  at java.security.AccessController.doPrivileged(Native Method)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
[08:51:42.546] {main}  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
[08:51:42.546] {main}  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
[08:51:42.546] {main}  at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
[08:51:42.546] {main}  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
[08:51:42.546] {main}  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
[08:51:42.546] {main}  at com.caucho.server.webapp.WebApp.start(WebApp.java:1866)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployController.startImpl(DeployController.java:667)
[08:51:42.546] {main}  at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:549)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:160)
[08:51:42.546] {main}  at com.caucho.server.webapp.WebAppContainer.start(WebAppContainer.java:659)
[08:51:42.546] {main}  at com.caucho.server.host.Host.start(Host.java:450)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployController.startImpl(DeployController.java:667)
[08:51:42.546] {main}  at com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAutoRedeployAutoStrategy.java:72)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployController.startOnInit(DeployController.java:549)
[08:51:42.546] {main}  at com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:160)
[08:51:42.546] {main}  at com.caucho.server.host.HostContainer.start(HostContainer.java:484)
[08:51:42.546] {main}  at com.caucho.server.cluster.Server.start(Server.java:1319)
[08:51:42.546] {main}  at com.caucho.server.cluster.Cluster.startServer(Cluster.java:710)
[08:51:42.546] {main}  at com.caucho.server.cluster.ClusterServer.startServer(ClusterServer.java:542)
[08:51:42.546] {main}  at com.caucho.server.resin.Resin.start(Resin.java:703)
[08:51:42.546] {main}  at com.caucho.server.resin.Resin.initMain(Resin.java:1162)
[08:51:42.546] {main}  at com.caucho.server.resin.Resin.main(Resin.java:1365)
[08:51:42.546] {main} Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'facebookVoteTitleDAO' of bean class [hk.egame.facebook.service.FacebookVoteMgr]: No property 'facebookVoteTitleDAO' found
[08:51:42.546] {main}  at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:382)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1287)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1248)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1008)
[08:51:42.546] {main}  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
[08:51:42.546] {main}  ... 32 more
[08:51:42.718] {main} WebApp[http://mg2.egame.hk/egame2011_fbapps] Set web app root system property: 'webapp.root' = [C:\resin-pro-3.1.9\webapps\egame2011_fbapps\]
[08:51:42.734] {main} WebApp[http://mg2.egame.hk/egame2011_fbapps] Initializing Log4J from [C:\resin-pro-3.1.9\webapps\egame2011_fbapps\WEB-INF\classes\log4j.properties]
[08:51:43.000] {main} WebApp[http://mg2.egame.hk/egame2011_fbapps] active
[08:51:43.375] {main} WebApp[http://mg2.egame.hk/resin-doc] active
[08:51:43.375] {main} Host[mg2.egame.hk] active
[08:51:43.937] {main} WebApp[http://mg.egame.hk] Initializing Spring root WebApplicationContext
 
 
————————————————
版权声明:本文为CSDN博主「lshxy320」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/lshxy320/article/details/6736913
(责任编辑:admin)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
广告位API接口通信错误,查看德得广告获取帮助
推荐内容
广告位API接口通信错误,查看德得广告获取帮助
广告位API接口通信错误,查看德得广告获取帮助