ibatis下insert、update、delete操作单元测试通过,发布到tomcat下执行失败
奇怪的问题,折腾了我一上午,分析一下。ibatis下执行insert、update、delete操作,单元测试通过,发布到tomcat下执行update、delete成功,而insert时却报错,出错信息如下,分析分析。
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: SqlMapClient operation; SQL [];
--- The error occurred in com/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.
--- The error occurred while applying a parameter map.
--- Check the insertInfoSort-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Duplicate entry '06' for key 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.
--- The error occurred while applying a parameter map.
--- Check the insertInfoSort-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Duplicate entry '06' for key 1
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)
root cause
org.springframework.dao.DataIntegrityViolationException: SqlMapClient operation; SQL [];
--- The error occurred in com/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.
--- The error occurred while applying a parameter map.
--- Check the insertInfoSort-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Duplicate entry '06' for key 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.
--- The error occurred while applying a parameter map.
--- Check the insertInfoSort-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Duplicate entry '06' for key 1
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)
root cause
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/nmgnews/fip/dao/ibatis/maps/FipInfoSort.xml.
--- The error occurred while applying a parameter map.
--- Check the insertInfoSort-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Duplicate entry '06' for key 1
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)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
页:
[1]