关于ibatis参数为null值时报错

我先把打印的错误贴出来
2010-6-21 14:04:13 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.sql.SQLException: 无效的列类型
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
	at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:5465)
	at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1028)
	
at org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:105)

	at com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameter(ParameterMap.java:172)
	at com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.setParameters(ParameterMap.java:126)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:78)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteUpdate(MappedStatement.java:216)
	at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:94)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:457)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
	at org.springframework.orm.ibatis.SqlMapClientTemplate$10.doInSqlMapClient(SqlMapClientTemplate.java:372)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:188)
	at org.springframework.orm.ibatis.SqlMapClientTemplate.update(SqlMapClientTemplate.java:370)
	at com.cssweb.common.security.user.dao.impl.UserBasicInfoWriteDAOImpl.updateLockDateByUserId(UserBasicInfoWriteDAOImpl.java:36)
	at com.cssweb.common.security.user.dao.impl.UserBasicInfoDAOImpl.updateLockDateByUserId(UserBasicInfoDAOImpl.java:49)
	at com.cssweb.common.security.user.service.UserService.updateLockDateByUserId(UserService.java:164)
	at com.cssweb.common.security.user.web.UserAction.login(UserAction.java:228)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
	at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.cssweb.common.web.filter.FiltrateRequestParamterFilter.doFilter(FiltrateRequestParamterFilter.java:81)
	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:78)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
	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:191)
	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:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Thread.java:595)



我分别用tomcat5.5和6.0部署,但是在6.0会出现这种错误,在5.5中用的是工程中导入的commons-dbcp-1.2.2.jar,而在6.0时候tomcat在lib目录下自有tomcat-dbcp.jar,所以如果在ibatis传入参数为null值的时候,须在变量中指定类型,如#id:NUMBER#,#name:VARCHAR2#,...,这样就可以避免这种错误了.
另外,jsp-api.jar如果冲突的话,JSP页面编译不会通过,所以在开发部署的过程中,需注意.

你可能感兴趣的:(java,apache,oracle,ibatis,struts)