=====================================
org.nutz.dao.DaoException: java.lang.ClassCastException: org.nutz.plugins.cache.dao.NSqlAdapter cannot be cast to com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:73)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:250)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:282)
at org.nutz.dao.impl.NutDao.func(NutDao.java:736)
at org.nutz.dao.impl.NutDao.func(NutDao.java:717)
at org.nutz.dao.impl.NutDao._count(NutDao.java:704)
at org.nutz.dao.impl.NutDao.count(NutDao.java:670)
at com.bsdkj.hdcyfwpt.modules.MainSetup.initSysData(MainSetup.java:105)
at com.bsdkj.hdcyfwpt.modules.MainSetup.init(MainSetup.java:67)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4917)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5609)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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: java.lang.ClassCastException: org.nutz.plugins.cache.dao.NSqlAdapter cannot be cast to com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor
at com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelect.accept0(OracleSelect.java:58)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at com.alibaba.druid.sql.ast.SQLObjectImpl.acceptChild(SQLObjectImpl.java:63)
at com.alibaba.druid.sql.ast.statement.SQLSelectStatement.accept0(SQLSelectStatement.java:59)
at com.alibaba.druid.sql.ast.SQLObjectImpl.accept(SQLObjectImpl.java:41)
at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:122)
at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:327)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
... 25 more
问答
将nutz-plugins-daocache的版本由1.b.53.r2更换为1.r.56后发生以下错误,是什么原因?
标签:
无
8 回复
druid版本多少?
来自炫酷的 NutzCN
@qq_386eea42 看来druid又加新的类,你可以试试改一下源码
来自炫酷的 NutzCN
我的代码只是获取操作员记录数
System.out.println("=====================================");
System.out.println("================"+dao.count(SysUser.class)+"=====================");
System.out.println("=====================================");
同样使用druid 1.0.19
使用nutz-plugins-daocache 1.b.53.r2版本没有问题,使用nutz-plugins-daocache 1.r.56就发生错误。跟druid没有关系吧?
@qq_386eea42 debug一下报错的地方
来自炫酷的 NutzCN
我是在MainSetup里:System.out.println("================"+dao.count(SysUser.class)+"=====================") 这句报错
/**
*
*/
public class MainSetup implements Setup {
private static final Log log = Logs.get();
static DictService dictService = Mvcs.ctx().getDefaultIoc().get(DictService.class);
static ConfigService configService = Mvcs.ctx().getDefaultIoc().get(ConfigService.class);
public void init(NutConfig config) {
try {
log.info("MainSetup init begin ...");
NutShiro.DefaultLoginURL = "/logout";
// 检查环境
if (!Charset.defaultCharset().name().equalsIgnoreCase(Encoding.UTF8)) {
log.warn("This project must run in UTF-8, pls add -Dfile.encoding=UTF-8 to JAVA_OPTS");
}
// 获取Ioc容器及Dao对象
Ioc ioc = config.getIoc();
Dao dao = ioc.get(Dao.class);
// 初始化数据表
log.info("System DataBase init begin ...");
initSysData(config, dao);
log.info(" ... System DataBase init complete");
// 初始化SysLog,触发全局系统日志初始化
log.info("System Log Service init begin ...");
ioc.get(SysLogService.class);
log.info(" ... System Log Service init complete");
// 初始化Velocity
velocityInit(config);
// 检查一下Ehcache CacheManager 是否正常.
CacheManager cacheManager = ioc.get(CacheManager.class);
log.debug("Ehcache CacheManager = " + cacheManager);
// 初始化系统变量
log.info("System Setting init begin ...");
initSysSetting(config, dao);
log.info(" ... System Setting init complete");
log.info(" ... MainSetup init complete");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 初始化数据表
*
* @param config
* @param dao
*/
private void initSysData(NutConfig config, Dao dao) {
// 为全部标注了@Table的bean建表
Daos.createTablesInPackage(dao, "com.bsdkj.hdcyfwpt", false);
System.out.println("=====================================");
System.out.println("================"+dao.count(SysUser.class)+"=====================");
System.out.println("=====================================");
}
添加回复
请先登陆