请问,在连接oracle库里为什么连不成功。

[ERROR]-[Thread: main]-[com.alibaba.druid.pool.DruidDataSource.init()]: {dataSource-1} init error

java.sql.SQLException: oracle.jdbc.driver.OracleDriver

at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:566)

at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:642)

at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:988)

at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:984)

at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:103)

at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:43)

at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:226)

at com.jfinal.core.Config.startPlugins(Config.java:107)

at com.jfinal.core.Config.configJFinal(Config.java:53)

at com.jfinal.core.JFinal.init(JFinal.java:63)

at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)

at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:119)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:724)

at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)

at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)

at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)

at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)

at org.eclipse.jetty.server.Server.doStart(Server.java:277)

at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)

at com.jfinal.server.JettyServerForIDEA.doStart(JettyServerForIDEA.java:133)

at com.jfinal.server.JettyServerForIDEA.start(JettyServerForIDEA.java:72)

at com.jfinal.core.JFinal.start(JFinal.java:169)

at com.javen.common.APPConfig.main(APPConfig.java:282)

Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:264)

at com.alibaba.druid.util.JdbcUtils.createDriver(JdbcUtils.java:564)

... 25 more


评论区

xwt

2017-12-14 19:07

//配置Oracle驱动
String driver=PropKit.get("oracle.driver");
String url=PropKit.get("oracle.url");
String username=PropKit.get("oracle.username");
String password=PropKit.get("oracle.password");
DruidPlugin dp=new DruidPlugin(url, username, password, driver);
dp. setDriverClass("oracle.jdbc.driver.OracleDriver");
me.add(dp);
ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);
me.add(arp);
// 配置Oracle方言
arp.setDialect(new OracleDialect());
// 配置属性名(字段名)大小写不敏感容器工厂
arp.setContainerFactory(new CaseInsensitiveContainerFactory());
////arp.addMapping("user", "user_id", User.class);

xwt

2017-12-14 19:07

已把ojdbc14.jar放在lib下了

Javen

2017-12-16 16:24

@xwt maven 项目需要在pom中配置一下lib下的jar

xwt

2018-01-01 21:13

好的,多谢

热门反馈

扫码入社