错误提示:SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];

这个问题已经折腾我两天了,今天终于在一位同事(zhangwei)的帮助下解决了。

1.起初没有创建序列s_log,因此需要在Oracle补上s_log序列。

<!-- 增加 日志 -->
 <insert id="logSave"
  parameterClass="com.reportcenter.sys.dto.OperateLogDto">
  INSERT INTO
  T_LOG(C_AUTOID,USRCDE,USRADDRESS,OPERATION,BEGINTME,ENDTME,OPERATETIMER,STATE,MESSAGE) VALUES(s_log.nextval,#usrCde#,#usrAddress#,#operation#,#beginTme#,#endTme#,#operateTimer#,#state#,#message#)
 </insert>

2.接着就出现下面的问题,主要是usrCde(日志表里的用户代码)属性在系统登陆验证时为空值所致。因此在相应代码处加上对空值的判断,如果为空,就从登陆页面取得userCde值。

if (request.getSession().getAttribute(Constants.usrCde) == null) {
    usr = request.getParameter("userCde");
   } else {
    usr = (String) request.getSession().getAttribute(
      Constants.usrCde);
   }

Tomcat提示错误如下:

INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
INFO [org.springframework.jdbc.support.SQLErrorCodesFactory] - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];  
--- The error occurred in sqlmap-mapping-log-operate.xml. 
--- The error occurred while applying a parameter map. 
--- Check the logSave-InlineParameterMap. 
--- Check the parameter mapping for the 'usrCde' property. 
--- Cause: java.sql.SQLException: 无效的列类型; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlmap-mapping-log-operate.xml. 
--- The error occurred while applying a parameter map. 
--- Check the logSave-InlineParameterMap. 
--- Check the parameter mapping for the 'usrCde' property. 
--- Cause: java.sql.SQLException: 无效的列类型
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlmap-mapping-log-operate.xml. 
--- The error occurred while applying a parameter map. 
--- Check the logSave-InlineParameterMap. 
--- Check the parameter mapping for the 'usrCde' property. 
--- Cause: java.sql.SQLException: 无效的列类型
 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
 at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
 at org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:370)
 at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194)
 at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:368)
 at com.reportcenter.sys.dao.OperateLogDaoImpl.save(OperateLogDaoImpl.java:41)
 at com.reportcenter.sys.service.SysLogServiceImpl.save(SysLogServiceImpl.java:52)
 at com.reportcenter.util.db.Log.log(Log.java:61)
 at com.reportcenter.sys.service.BaseService.doService(BaseService.java:92)
 at com.reportcenter.sys.controller.LoginController.handleRequestInternal(LoginController.java:42)
 at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
 at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.reportcenter.util.LoginFilter.doFilter(LoginFilter.java:42)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: 无效的列类型
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
 at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
 at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
 at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1316)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:105)
 at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameter(BasicParameterMap.java:171)
 at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.setParameters(BasicParameterMap.java:125)
 at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:79)
 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
 ... 37 more
com.reportcenter.exception.DaoException: error.sys.log.db.add; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];  
--- The error occurred in sqlmap-mapping-log-operate.xml. 
--- The error occurred while applying a parameter map. 
--- Check the logSave-InlineParameterMap. 
--- Check the parameter mapping for the 'usrCde' property. 
--- Cause: java.sql.SQLException: 无效的列类型; 
 


posted @ 2009-03-10 16:53 断点 阅读(2104) | 评论 (0)

你可能感兴趣的:(错误提示:SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17004];)