ibatis下insert、update、delete操作单元测试通过,发布到tomcat下执行失败

奇怪的问题,折腾了我一上午,分析一下。

ibatis下执行insert、update、delete操作,单元测试通过,发布到tomcat下执行update、delete成功,而insert时却报错,出错信息如下,分析分析。

typeExceptionreport

message

descriptionTheserverencounteredaninternalerror()thatpreventeditfromfulfillingthisrequest.

exception

org.springframework.web.util.NestedServletException:Requestprocessingfailed;nestedexceptionisorg.springframework.dao.DataIntegrityViolationException:SqlMapClientoperation;SQL[];

---Theerroroccurredincom/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.

---Theerroroccurredwhileapplyingaparametermap.

---ChecktheinsertInfoSort-InlineParameterMap.

---Checkthestatement(updatefailed).

---Cause:java.sql.SQLException:Duplicateentry'06'forkey1;nestedexceptioniscom.ibatis.common.jdbc.exception.NestedSQLException:

---Theerroroccurredincom/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.

---Theerroroccurredwhileapplyingaparametermap.

---ChecktheinsertInfoSort-InlineParameterMap.

---Checkthestatement(updatefailed).

---Cause:java.sql.SQLException:Duplicateentry'06'forkey1

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:487)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)

javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)

rootcause

org.springframework.dao.DataIntegrityViolationException:SqlMapClientoperation;SQL[];

---Theerroroccurredincom/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.

---Theerroroccurredwhileapplyingaparametermap.

---ChecktheinsertInfoSort-InlineParameterMap.

---Checkthestatement(updatefailed).

---Cause:java.sql.SQLException:Duplicateentry'06'forkey1;nestedexceptioniscom.ibatis.common.jdbc.exception.NestedSQLException:

---Theerroroccurredincom/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.

---Theerroroccurredwhileapplyingaparametermap.

---ChecktheinsertInfoSort-InlineParameterMap.

---Checkthestatement(updatefailed).

---Cause:java.sql.SQLException:Duplicateentry'06'forkey1

org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:246)

org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:196)

org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:367)

com.nmgnews.fip.dao.ibatis.SqlMapFipInfoSortDao.insertInfoSort(SqlMapFipInfoSortDao.java:30)

com.nmgnews.fip.web.spring.EditInfoSortController.handleRequest(EditInfoSortController.java:48)

org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)

javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)

rootcause

com.ibatis.common.jdbc.exception.NestedSQLException:

---Theerroroccurredincom/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.

---Theerroroccurredwhileapplyingaparametermap.

---ChecktheinsertInfoSort-InlineParameterMap.

---Checkthestatement(updatefailed).

---Cause:java.sql.SQLException:Duplicateentry'06'forkey1

com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)

com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)

com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)

org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:369)

org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)

org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:367)

com.nmgnews.fip.dao.ibatis.SqlMapFipInfoSortDao.insertInfoSort(SqlMapFipInfoSortDao.java:30)

com.nmgnews.fip.web.spring.EditInfoSortController.handleRequest(EditInfoSortController.java:48)

org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)

org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)

org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)

org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)

javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)

noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/5.0.28logs.

相关推荐