在最新版的druid 中,发生如下异常
Exception in thread "main" java.lang.NoSuchMethodError: com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.getOption()Lcom/alibaba/druid/sql/ast/expr/SQLAggregateExpr$Option;
at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:110)
at com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.accept0(SQLAggregateExpr.java:121)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:970)
at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:92)
at com.alibaba.druid.sql.ast.statement.SQLSelectItem.accept0(SQLSelectItem.java:86)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.printSelectList(SQLASTOutputVisitor.java:242)
at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.printSelectList(MySQLSelectVisitor.java:56)
at com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor.visit(MySqlOutputVisitor.java:318)
at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:68)
at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:232)
at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:223)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:859)
at com.alibaba.druid.sql.ast.statement.SQLSelect.accept0(SQLSelect.java:87)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:1048)
at com.alibaba.druid.sql.ast.statement.SQLSelectStatement.accept0(SQLSelectStatement.java:58)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.dangdang.ddframe.rdb.sharding.parser.SQLParseEngine.parse(SQLParseEngine.java:66)
at com.dangdang.ddframe.rdb.sharding.router.SQLRouteEngine.parseSQL(SQLRouteEngine.java:85)
at com.dangdang.ddframe.rdb.sharding.router.PreparedSQLRouter.route(PreparedSQLRouter.java:57)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.routeSQL(ShardingPreparedStatement.java:157)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:113)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:111)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy67.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
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:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434)
at com.sun.proxy.$Proxy58.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:239)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:140)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
at com.sun.proxy.$Proxy59.selectUser(Unknown Source)
at com.marklife.test.service.UserService.selectUser(UserService.java:28)
at com.marklife.test.service.UserService$$FastClassBySpringCGLIB$$9936350d.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
at com.marklife.test.service.UserService$$EnhancerBySpringCGLIB$$b2071c08.selectUser()
at com.marklife.test.TestDao.main(TestDao.java:39)
对比发现在com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor类中依赖于druid中的函数声明以修改,部分类也已经删除。
在最新版的druid 中,发生如下异常 Exception in thread "main" java.lang.NoSuchMethodError: com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.getOption()Lcom/alibaba/druid/sql/ast/expr/SQLAggregateExpr$Option; at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:110) at com.alibaba.druid.sql.ast.expr.SQLAggregateExpr.accept0(SQLAggregateExpr.java:121) at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41) at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:970) at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:92) at com.alibaba.druid.sql.ast.statement.SQLSelectItem.accept0(SQLSelectItem.java:86) at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41) at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.printSelectList(SQLASTOutputVisitor.java:242) at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.printSelectList(MySQLSelectVisitor.java:56) at com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor.visit(MySqlOutputVisitor.java:318) at com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor.visit(MySQLSelectVisitor.java:68) at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:232) at com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.accept0(MySqlSelectQueryBlock.java:223) at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41) at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:859) at com.alibaba.druid.sql.ast.statement.SQLSelect.accept0(SQLSelect.java:87) at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41) at com.alibaba.druid.sql.visitor.SQLASTOutputVisitor.visit(SQLASTOutputVisitor.java:1048) at com.alibaba.druid.sql.ast.statement.SQLSelectStatement.accept0(SQLSelectStatement.java:58) at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41) at com.dangdang.ddframe.rdb.sharding.parser.SQLParseEngine.parse(SQLParseEngine.java:66) at com.dangdang.ddframe.rdb.sharding.router.SQLRouteEngine.parseSQL(SQLRouteEngine.java:85) at com.dangdang.ddframe.rdb.sharding.router.PreparedSQLRouter.route(PreparedSQLRouter.java:57) at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.routeSQL(ShardingPreparedStatement.java:157) at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:113) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:111) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy67.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) 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:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) at com.sun.proxy.$Proxy58.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:239) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:140) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy59.selectUser(Unknown Source) at com.marklife.test.service.UserService.selectUser(UserService.java:28) at com.marklife.test.service.UserService$$FastClassBySpringCGLIB$$9936350d.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
at com.marklife.test.service.UserService$$EnhancerBySpringCGLIB$$b2071c08.selectUser()
at com.marklife.test.TestDao.main(TestDao.java:39)
对比发现在com.dangdang.ddframe.rdb.sharding.parser.visitor.basic.mysql.MySQLSelectVisitor类中依赖于druid中的函数声明以修改,部分类也已经删除。