当前位置:网站主页>网站技术资料>java>文章内容

java常见错误以及可能原因集锦

41,Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (SD0702.FK82D343CF49A4B831) violated - parent key not found
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
有可能是ID生成策略的问题,我将它XML映射文件改成<generator class="increment" />就好了

42,
2007-08-19 16:21:43,290 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/OSS].[action]] - Servlet.service() for servlet action threw exception
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Module#2]
java.util.ConcurrentModificationException
原因:已经有对象拥有了所选择的module,用clear(),而不是remove();

43,
ERROR [org.apache.catalina.session.ManagerBase] - IOException while loading persisted sessions: java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429
java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429
在Module中加上一个关键字:transient

44,
Caused by: java.sql.BatchUpdateException: ORA-02292: integrity constraint (SD0702.SYS_C00132664) violated - child record found
原因:有其他的表引用了该表的外建,所以报这个异常,如果没有引用就不会出现

45,
出现数组越界的时候,看看是不是循环时没有加=,比如:
for(int i = 1; i<arr.length;i++)可以改成
for(int i = 1; i<=arr.length;i++)


46.如果使用Ant和Junit是被报找不到test,检查一下是否误用了private
出错信息:
<failure message="No tests found in test.AllTest" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: No tests found in test.AllTest
该错误有个很特别的特点,当你不通过ant来运行测试,而是通过AllTest类来运行的话,可以正常运行。小心哦

  • 快速服务服务:网站策划 | 网站建设 | 北京网站建设 | 网站推广 | 网罗SEO
  • 联系网罗: 咨询电话:010-89630319 Mail:admin#wonlu.com Msn:刘先生 QQ:26402294
  •   2006-2008 Wonlu.com 北京网罗无限-京ICP备06036090号 网罗SEO