Hibernate出现的异常:
1. org.hibernate.PropertyNotFoundException: Could not locate getter method for property [cn.itcast.domain.Customer#custId]
原因:在实体类中没有生成get方法。导致的
Hibernate和Spring框架整合时出现的异常:
org.springframework.orm.hibernate5.HibernateQueryException: cst_customer is not mapped [from cst_customer]
;
原因:使用hql时候查询时候,写的是查询表,但是hibernate操作的是映射对象,而不是表,把表名改成映射文件里的对象名就可以了
Struts整合Spring框架配置报异常:
atcom.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-
Caused by: java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
原因:
1.lib中我多导入包的原因:去掉struts2-spring-plugin-2.1.8包就可以,因为没有用到spring。
2.如果是用spring了,没加监听器,也会出现这种情况,这个时候在WEB.XML中假如jar包就可以了。
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
我是为了图方便粘贴的jar包过来,还没有配置Spring框架,只是想测试我的struts2框架是否成功,然后就一直报这个错,找的头都大了,后来根据错误提示,一点点去找到的,难受