java.lang.reflect.InvocationTargetException 错误

mysql错误

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.elan.quick.config.SqlSessionInterceptor.invoke(SqlSessionInterceptor.java:36)
    at com.sun.proxy.$Proxy123.selectList(Unknown Source)
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
    at com.sun.proxy.$Proxy157.selectTotal(Unknown Source)
    at com.elan.expo.schedule.DashSchedule.getTotalExceldata(DashSchedule.java:186)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.reflect.UndeclaredThrowableException
### Cause: java.lang.reflect.UndeclaredThrowableException
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    ... 25 more
Caused by: java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy189.query(Unknown Source)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
    ... 26 more
Caused by: com.foundationdb.sql.parser.SQLParserException: Encountered " <SINGLEQUOTED_STRING> "\'\u4f01\u4e1aid\' "" at line 1, column 25.
Was expecting one of:
    <IDENTIFIER> ...
    <BACKQUOTED_IDENTIFIER> ...
    <DOUBLEQUOTED_IDENTIFIER> ...
    
    at com.foundationdb.sql.parser.SQLParser.parseStatement(SQLParser.java:106)
    at com.job1001.util.DynamicUtil.executeInvocation(DynamicUtil.java:59)
    at com.job1001.plugins.DynamicOtherSQLPlugin.intercept(DynamicOtherSQLPlugin.java:71)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
    ... 28 more
Caused by: com.foundationdb.sql.parser.ParseException: Encountered " <SINGLEQUOTED_STRING> "\'\u4f01\u4e1aid\' "" at line 1, column 25.
Was expecting one of:
    <IDENTIFIER> ...
    <BACKQUOTED_IDENTIFIER> ...
    <DOUBLEQUOTED_IDENTIFIER> ...
    
    at com.foundationdb.sql.parser.SQLGrammar.generateParseException(SQLGrammar.java:22325)
    at com.foundationdb.sql.parser.SQLGrammar.jj_consume_token(SQLGrammar.java:22170)
    at com.foundationdb.sql.parser.SQLGrammar.internalIdentifier(SQLGrammar.java:15458)
    at com.foundationdb.sql.parser.SQLGrammar.identifier(SQLGrammar.java:15467)
    at com.foundationdb.sql.parser.SQLGrammar.asClause(SQLGrammar.java:4570)
    at com.foundationdb.sql.parser.SQLGrammar.derivedColumn(SQLGrammar.java:4543)
    at com.foundationdb.sql.parser.SQLGrammar.selectSublist(SQLGrammar.java:4529)
    at com.foundationdb.sql.parser.SQLGrammar.selectColumnList(SQLGrammar.java:4481)
    at com.foundationdb.sql.parser.SQLGrammar.selectList(SQLGrammar.java:4475)
    at com.foundationdb.sql.parser.SQLGrammar.querySpecification(SQLGrammar.java:4424)
    at com.foundationdb.sql.parser.SQLGrammar.simpleTable(SQLGrammar.java:4378)
    at com.foundationdb.sql.parser.SQLGrammar.nonJoinQueryPrimary(SQLGrammar.java:4357)
    at com.foundationdb.sql.parser.SQLGrammar.nonJoinQueryTerm(SQLGrammar.java:4246)
    at com.foundationdb.sql.parser.SQLGrammar.queryExpression(SQLGrammar.java:4151)
    at com.foundationdb.sql.parser.SQLGrammar.preparableSelectStatement(SQLGrammar.java:2259)
    at com.foundationdb.sql.parser.SQLGrammar.preparableSQLDataStatement(SQLGrammar.java:2127)
    at com.foundationdb.sql.parser.SQLGrammar.StatementPart(SQLGrammar.java:1870)
    at com.foundationdb.sql.parser.SQLGrammar.Statement(SQLGrammar.java:1768)
    at com.foundationdb.sql.parser.SQLGrammar.parseStatement(SQLGrammar.java:1754)
    at com.foundationdb.sql.parser.SQLParser.parseStatement(SQLParser.java:103)
    ... 31 more
java.lang.NullPointerException
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:142)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
    at com.sun.proxy.$Proxy157.selectTotal(Unknown Source)
    at com.elan.expo.schedule.DashSchedule.getTotalExceldata(DashSchedule.java:186)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

查看  Mapper.xml

是否  as 后面接的是 单引号,将as后面的单引号改为双引号  问题解决 

select t.cid,t.cn,
sum(case t.eduId1 when '本科以下' then t.num else 0 end) as '本科以下',
sum(case t.eduId1 when '本科' then t.num else 0 end) as '本科',
sum(case t.eduId1 when '硕士' then t.num else 0 end) as '硕士',

 

 

 

 

相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页