ssh异常整理

1.struts1.2+hibernate3.1+spring2.0整合的时候如果在注入的时候变量命名不规范如sCarSell,则spring会报错: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sCarSell' of bean class [com.kingtoon.count.struts.action.CountAction]: Bean property 'sCarSell' is not writable or has an invalid setter method. Did you mean 'SCarSell'?

解决方法:改变量名->secCarSell

2.启动tomcat的时候跳出这样的错误,IOException while loading persisted sessions: java.io.EOFException

解决方法:到tomcat安装目录下的work里面找相关工程下的SESSIONS.ser等有ser后缀的文件删掉,重启tomcat就ok了

3.ssh整合找不到action

参考地址:http://topic.csdn.net/u/20071003/17/c45495ce-e59a-45ad-a703-8ba42d4db8b1.html 

4. javax.servlet.jsp.JspException: You must specify exactly one of src, srcKey, page, or pageKey

这个错误原因很简单,主要是我原来用的<img src="" /> 而后来想换成struts<html:img /> 但是我没填好里面的属性就关机了,第二天运行发现错误慢慢找发现了.把struts标签删掉就OK了.

5 .在映射文件里面配置一对多双向关联的时候,如果配置少了一些一些属性,则启动tomcat的时候会报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/config/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.iss.mycar.po.OnlineQa column: consultant_id (should be mapped with insert="false" update="false")
Caused by:
org.hibernate.MappingException: Repeated column in mapping for entity: com.iss.mycar.po.OnlineQa column: consultant_id (should be mapped with insert="false" update="false")
 at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)

解决办法是:在映射文件<many-to-one> 标签里面添加 insert="false"  update="false" 就可以解决了。

6.Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row

count: 0; expected: 1
 at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
 at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
 at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
 

这个异常是我的mysql 数据库里面的ID是自增长的,但是我插入对象的时候指定了ID,所以报错!

使用的是hibernate的saveOrUpdate方法保存实例。saveOrUpdate方法要求ID为null时才执行SAVE,在其它情况下执行UPDATE。在保存实例的时候是新增,但你的ID不为null,所以使用的是UPDATE,但是数据库里没有主键相关的值,所以出现异常。

解决办法是:不指定ID 让数据库自动添加。

6.java.lang.IllegalArgumentException: argument type mismatch

这个错误主要是actionForm里面数据对应到的页面数据类型不匹配造成,花了我几个小时来找555555

解决办法:把actonForm里面的类型改成页面对应的类型。

7.javax.servlet.ServletException: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

这个原因是我用this.getHibernateTemplate().getSessionFactory().getCurrentSession()来生成session

后来把这句话改成this.getHibernateTemplate().getSessionFactory().openSession(); 就解决了!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值