刚进入公司就跟着项目经理起手一个项目:项目经理搭好基本框架后共享给我们进行简单功能的编写,在我写第一个小功能的时候遇到了一下几个问题,大体上都属于刚接手新框架是出现的一些ssh配置方面的问题:
1、报错:this web application instance has been stopped already. Could not load com.mysql.jdbc.ProfilerEventHandlerFactory.
解决方法:原因是因为在tomcat重启的时候,之前的tomcat的线程还没有完全关闭,最新启动tomcat就会报这个异常,
2、报错:Could not determine type for: Date, at table: partyMember, for columns:
解决方法:hbm.xml中的type类型要写全
3、报错:class com/brzt/gsmis/framework/entity/BasicInfo.PartyMember not found while looking for property: PartyKey
解决方法:这个属性是一个id属性,当时没加上type类型,也要加上
4、报错:Invalid property 'partyMemberService' of bean class [com.brzt.gsmis.framework.action.BasicInfo.PartyMemberAction]: Bean property 'partyMemberService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
解决方法:在ACTION中生成他的get/set方法,我当时偷懒以为不生成可以用,谁知道报错了
5、org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolder
原因: 由于hibernate4已经完全可以实现事务了 与spring3.1中的hibernatedao,hibernateTemplete等有冲突,所以spring3.1里已经不提供hibernatedaosupport,hibernateTemplete了,
解决方法:只能用hibernate原始的方式用session。也有可能是导错包了
我的方法是import org.springframework.orm.hibernate3.support.HibernateDaoSupport;改为import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
6、报错: A different object with the same identifier value was already associated with the session :
解决方法:currentSession().flush();
currentSession().clear();
//不要用update()方法
getHibernateTemplate().merge(object); 点击打开原文