`
java_frog
  • 浏览: 259208 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

关于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页面编译不会通过,所以在开发部署的过程中,需注意.

分享到:
评论

相关推荐

    ibatis的错误总结

    这里的问题在于`parameterClass`被设定为`Long`,但实际传递的参数`roleId`的值是通过`#roleId#`引用的。然而,如果`roleId`是作为`Map`的一个键值对传递的,那么`parameterClass`应该被设置为`java.util.Map`。因此...

    springmybatis

    以前曾经用过ibatis,这是mybatis的前身,当时在做项目时,感觉很不错,比hibernate灵活。性能也比hibernate好。而且也比较轻量级,因为当时在项目中,没来的及做很很多笔记。后来项目结束了,我也没写总结文档。已经...

    自整理Java关于基础和框架的面试题

    ### 自整理Java关于基础和框架的面试题 #### 基础知识点 ##### JDK常用的包 - **java.lang**: 包含所有基本类,如`String`、`Math`等。 - **java.util**: 提供集合框架、日期/时间设施、事件模型、杂项实用程序类...

    java必备知识点大全.pdf

    此外,Hashtable不允许键或值为null,而HashMap可以。 九大隐式对象:JSP中有九个预定义的对象,包括request、response、session、application等。 Forward与Redirect的区别:Forward是服务器请求资源,服务器直接...

    java面试知识

    - **null值**:Hashtable不允许null键和null值;HashMap允许一个null键和任意数量的null值。 - **性能**:一般情况下,HashMap比Hashtable性能更好。 ##### 九大隐式对象 - **page**:代表当前页面的范围。 - **...

Global site tag (gtag.js) - Google Analytics