开发者社区> 问答> 正文

jfinal 带子查询 druid报错?报错

@JFinal 你好,想跟你请教个问题:

jfinal 带子查询 如 and s1 in (select gridconto_page_sqfwgl from V_FW_ZHXX) 这样条件 ,报错了 


com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.ClassCastException: com.alibaba.druid.sql.visitor.SQLEvalVisitorImpl cannot be cast to com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor
	at com.jfinal.plugin.activerecord.Db.paginate(Db.java:554)
	at com.jfinal.plugin.activerecord.Db.paginate(Db.java:593)
	at com.simple.sqpt.services.FWCXService.doGetHouseInfo(FWCXService.java:172)
	at com.simple.sqpt.controller.FWCXController.getFwInfo(FWCXController.java:20)
	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:597)
	at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55)
	at com.simple.sqpt.Interceptor.SessionInterceptor.intercept(SessionInterceptor.java:40)
	at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:51)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:73)
	at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:58)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	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:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	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.Http11AprProcessor.process(Http11AprProcessor.java:879)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: com.alibaba.druid.sql.visitor.SQLEvalVisitorImpl cannot be cast to com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor
	at com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock.accept0(SQLServerSelectQueryBlock.java:39)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.acceptChild(SQLObjectImpl.java:62)
	at com.alibaba.druid.sql.ast.statement.SQLSelect.accept0(SQLSelect.java:65)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.acceptChild(SQLObjectImpl.java:62)
	at com.alibaba.druid.sql.ast.expr.SQLInSubQueryExpr.accept0(SQLInSubQueryExpr.java:77)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.visit(SQLEvalVisitorUtils.java:728)
	at com.alibaba.druid.sql.visitor.SQLEvalVisitorImpl.visit(SQLEvalVisitorImpl.java:79)
	at com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr.accept0(SQLBinaryOpExpr.java:80)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.visitor.SQLEvalVisitorUtils.eval(SQLEvalVisitorUtils.java:135)
	at com.alibaba.druid.wall.spi.WallVisitorUtils.getValue(WallVisitorUtils.java:687)
	at com.alibaba.druid.wall.spi.WallVisitorUtils.getValue(WallVisitorUtils.java:944)
	at com.alibaba.druid.wall.spi.WallVisitorUtils.getConditionValue(WallVisitorUtils.java:904)
	at com.alibaba.druid.wall.spi.WallVisitorUtils.checkSelelct(WallVisitorUtils.java:215)
	at com.alibaba.druid.wall.spi.SQLServerWallVisitor.visit(SQLServerWallVisitor.java:167)
	at com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock.accept0(SQLServerSelectQueryBlock.java:43)
	at com.alibaba.druid.sql.dialect.sqlserver.ast.SQLServerSelectQueryBlock.accept0(SQLServerSelectQueryBlock.java:39)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.acceptChild(SQLObjectImpl.java:62)
	at com.alibaba.druid.sql.ast.statement.SQLSelect.accept0(SQLSelect.java:65)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.acceptChild(SQLObjectImpl.java:62)
	at com.alibaba.druid.sql.ast.statement.SQLSelectStatement.accept0(SQLSelectStatement.java:50)
	at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:40)
	at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:642)
	at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:572)
	at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:605)
	at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:229)
	at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:446)
	at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:928)
	at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122)
	at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:446)
	at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342)
	at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:311)
	at com.jfinal.plugin.activerecord.Db.query(Db.java:39)
	at com.jfinal.plugin.activerecord.CPI.query(CPI.java:40)
	at com.jfinal.plugin.activerecord.dialect.AnsiSqlDialect.takeOverDbPaginate(AnsiSqlDialect.java:186)
	at com.jfinal.plugin.activerecord.Db.paginate(Db.java:520)
	at com.jfinal.plugin.activerecord.Db.paginate(Db.java:552)
	... 25 more

改用 c3p0的数据源就可以了,什么问题啊。

展开
收起
爱吃鱼的程序员 2020-06-22 15:36:57 752 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
    @wenshao你家东西好像有问题。
    druid什么版本?你启动了WallFilter?

    <version>0.2.25</version> 

    启动了。 newWallFilter需要设置吗?

    测试了去掉   Wall就可以运行。

    请问wall里是否需要设置什么?

    2020-06-22 15:37:12
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载