首先贴一下异常日志
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:46) ~[mybatis-3.1.1.jar:3.1.1]
at com.jd.etms.framework.utils.orm.monitor.DbAccessInterceptor.intercept(DbAccessInterceptor.java:181) ~[framework-utils-1.2.1-20170710.103316-1.jar:?]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:57) ~[mybatis-3.1.1.jar:3.1.1]
at com.sun.proxy.$Proxy88.query(Unknown Source) ~[?:?]
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101) ~[mybatis-3.1.1.jar:3.1.1]
--
Caused by: org.apache.ibatis.builder.BuilderException: Improper inline parameter map format. Should be: #{propName,attr1=val1,attr2=val2}
at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.parseParameterMapping(SqlSourceBuilder.java:144) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.buildParameterMapping(SqlSourceBuilder.java:78) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.handleToken(SqlSourceBuilder.java:73) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.parsing.GenericTokenParser.parse(GenericTokenParser.java:47) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.builder.SqlSourceBuilder.parse(SqlSourceBuilder.java:54) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.builder.xml.dynamic.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:40) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:241) ~[mybatis-3.1.1.jar:3.1.1]
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:79) ~[mybatis-3.1.1.jar:3.1.1]
... 66 more
注意Improper inline parameter map format. Should be: #{propName,attr1=val1,attr2=val2}这个报错,出现这个报错信息很大可能是你的xml文件中#{propName,jdbcType=VARCHAR}中的等号两边有空格,去掉空格就可以了。
感想:
mybatis的相关的xml文件写了很多,从来没有发现这个问题,不是这次报错都没有注意到这个问题,是个半年重新写代码还是有影响.