JAVA中的SSH中的异常不知道解决~
来源:百度知道 编辑:UC知道 时间:2024/06/12 21:52:49
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/baddnews' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'newsdao' of bean class [com.sunshine.struts.action.BaddnewsAction]: No property 'newsdao' found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractB
BaddnewsAction这个类里没newsdao这个property,或者是没有setter/getter.
即
getNewsdao() 这个方法,有吗?
顺便提一下,dao和action之间应该还有一层service才好吧,action里直接用dao好像不太好。
首先applicationContext.xml这个配置文件的位置要对,
你的是在WEB-INF/下面吗?
如果在,你要看看applicationContext.xml这个配置文件中baddnews这个类的配置是否正确。
第二个是BaddnewsAction这个类没有newsdao这个属性,不过这个异常估计是第一个异常引起的
'/baddnews' 在web-inf下的applicationContext.xml没有定义,Initialization of bean failed nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'newsdao' of bean class [com.sunshine.struts.action.BaddnewsAction]: No property 'newsdao' found
初始化bean失败,注入异常是,类文件com.sunshine.struts.action.BaddnewsAction无效的属性名'newsdao' ,没有发现newsdao属性.
看下你的com.sunshine.struts.action.BaddnewsAction类里面是不是属性名写错了,或者没写set 方法
No property 'newsdao' found 。。。没找到newsdao这个参数
初始化Bean失败了,applicationContext.xml配置文件有问题。
没有找到baddnews 看看是否大小写的问题