Value '0000-00-00'notberepresentedasql.TimesTimest

java一个错误: Error querying database. Cause: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp

The error may exist in com/dangdang/product/cron/dao/ProductCronDao.java (best guess)

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: select id,product_id,status,error_nums,error_reason,error_source,creation_date,last_changed_date from job_error_log where status=0 and error_nums<5

Cause: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp

; SQL []; Value '0000-00-00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:107) ~[spring-jdbc-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80) ~[spring-jdbc-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73) ~[mybatis-spring-1.2.1.jar:1.2.1]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:368) ~[mybatis-spring-1.2.1.jar:1.2.1]
at $Proxy3.selectList(Unknown Source) ~[na:na]
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) ~[mybatis-spring-1.2.1.jar:1.2.1]
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:114) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43) ~[mybatis-3.2.3.jar:3.2.3]
at $Proxy12.selectJobErrorLog(Unknown Source) ~[na:na]
at com.dangdang.product.serviceImpl.CronServiceImpl.getJobErrorLog(CronServiceImpl.java:583) ~[product-cron-stock-0.0.1-SNAPSHOT.jar:na]
at com.dangdang.product.cron.job.JobRun.start(JobRun.java:53) ~[product-cron-stock-0.0.1-SNAPSHOT.jar:na]
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_05]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_05]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_05]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [na:1.7.0_05]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [na:1.7.0_05]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_05]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_05]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_05]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_05]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_05]
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
at com.mysql.jdbc.ResultSet.getNativeTimestamp(ResultSet.java:3918) ~[mysql-connector-java-3.1.14.jar:na]
at com.mysql.jdbc.ResultSet.getNativeConvertToString(ResultSet.java:3384) ~[mysql-connector-java-3.1.14.jar:na]
at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:3780) ~[mysql-connector-java-3.1.14.jar:na]
at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:4979) ~[mysql-connector-java-3.1.14.jar:na]
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4810) ~[mysql-connector-java-3.1.14.jar:na]
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4826) ~[mysql-connector-java-3.1.14.jar:na]
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342) ~[c3p0-0.9.1.2.jar:0.9.1.2]
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:34) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:23) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:51) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:415) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:334) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:289) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:264) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:234) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:152) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104) ~[mybatis-3.2.3.jar:3.2.3]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98) ~[mybatis-3.2.3.jar:3.2.3]
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_05]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_05]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) ~[mybatis-spring-1.2.1.jar:1.2.1]
… 22 common frames omitted

原因:“0000-00-00 00:00:00” 不符合规则
解决:相应字段修改:“2014-03-05 15:38:00”

你可能感兴趣的:('0000-00-00')