/** * 配置插件 */ public void configPlugin(Plugins me) { // 配置 druid 数据库连接池插件 DruidPlugin druidPlugin = new DruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim()); me.add(druidPlugin); // 配置ActiveRecord插件 ActiveRecordPlugin arp = new ActiveRecordPlugin("db1",druidPlugin); // 所有映射在 MappingKit 中自动化搞定 _MappingKit.mapping(arp); arp.setShowSql(true); me.add(arp); //============================================================================================ // DruidPlugin druidPlugin1 = new DruidPlugin(PropKit.get("orlurl"), PropKit.get("orlusername"), PropKit.get("orlpassword").trim()); druidPlugin1.setDriverClass("oracle.jdbc.driver.OracleDriver"); me.add(druidPlugin1); // 配置ActiveRecord插件 ActiveRecordPlugin arp1 = new ActiveRecordPlugin("db2",druidPlugin1); arp1.setDialect(new OracleDialect()); arp1.setContainerFactory(new CaseInsensitiveContainerFactory()); me.add(new EhCachePlugin()); arp1.addMapping("BDC_REC", "SLID",Rec.class); arp1.setShowSql(true); me.add(arp1); }
但是启动就报错。
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheManager at com.jfinal.plugin.ehcache.EhCachePlugin.createCacheManager(EhCachePlugin.java:91) at com.jfinal.plugin.ehcache.EhCachePlugin.start(EhCachePlugin.java:61) at com.jfinal.core.Config.startPlugins(Config.java:128) at com.jfinal.core.Config.configPluginWithOrder(Config.java:71) at com.jfinal.core.Config.configJFinal(Config.java:56) at com.jfinal.core.JFinal.init(JFinal.java:63) at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4708) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 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.ClassNotFoundException: net.sf.ehcache.CacheManager at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1335) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1163) ... 19 more
orlurl=jdbc:oracle:thin:@192.168.0.116:1521:orcl
orlusername=system
orlpassword=123456
连接局域网的另一个Oracle数据库。
希望大神指导下。怎么连接。
项目:JFinal