javaSSH框架错误解答.doc
文本预览下载声明
一 2
二SSH架构易出现的问题之Error creating bean with name * defined in file [*.xml] 2
三 3
四、SSH常遇见问题,缺包 8
五、Spring的常见错误分析 10
spring的又一个问题 12
六、SSH整合项目中容易出现的错误整理 13
七、ssh2框架易出现的错误 17
八、hibernate面对几个错误的解决关键 19
一
String hql=from StationInfo a where a.stationCode like %+stCode + %;
注意:hql中StationInfo 不是对应数据库中的表,而是对应值对象即:hibernate的映射类文件,org.bean.StationInfo 类
SSH架构易出现的问题之Error creating bean with name * defined in file [*.xml]org.apache.jasper.JasperException: Error creating bean with name indexall defined in file [E:\eclipse\Tomcat 5.5\webapps\fc\WEB-INF\beans.xml ]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property newsdao of bean class [org.fc.classes.indexall]:
Bean property newsdao is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
这是一个很头痛的问题,基本解决方法有以下两种:
1,如上面提示在定义的ACTION方法里没写GET,SET方法或者是方法写的不规范
解决方法:
按如下编写看看能否解决.
Beasn.xml文件部分 //此文件是SPRING的配置文件
//注册indexall这个ACTION
bean id=indexall class=org.fc.classes.indexall
property name=newsdao //newsdao为此ACTION调用的DAO文件
ref local=newsdao /
/property
/bean
//注册newsdao
bean id=newsdao class=org.fc.dao.base.Newsdao
property name=sessionFactory
ref local=sessionFactory /
/property
/bean
//最后必须在userDAOProxy中注册
bean id=userDAOProxy
*********************************************
property name=target
list
ref local=registerdao /
ref local=newsdao /
/list
/property
*********************************************
/bean
Indexall这个ACTION文件部分必须定义newsdao的GET,SET方法如下
private Newsdao newsdao;
public Newsdao getnewsdao(){
return newsdao;
}
public void setnewsdao(Newsdao newsdao){
this.newsdao=newsdao;
}
请大家注意下划线的变量,相同颜色的名字必须一致,不可有大小写错误!
2. TOMCAT版本的问题.本人一次用TOMCAT5.0编写,出现了上面的问题,结果是怎么都解决不了,后来换成了TOMCAT5.5.就一点问题都没有了,所以第一
显示全部