Groovy / Grails无法加载oracle.jdbc.driver.OracleDriver [英] Groovy/Grails cannot load oracle.jdbc.driver.OracleDriver

查看:317
本文介绍了Groovy / Grails无法加载oracle.jdbc.driver.OracleDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图测试一个连接到sql server的grails应用程序,现在我正在使用我自己的一个。这是我的datasource.groovy

  dataSource {
configClass = GrailsAnnotationConfiguration.class
pooled = true
driverClassName =oracle.jdbc.driver.OracleDriver
dialect =org.hibernate.dialect.Oracle10gDialect
dbCreate =update//'create','create-drop' ,'update','validate',''
url =jdbc:oracle:thin:@ 127.0.0.1:1521 / xe
username =blah
password =blah
properties {
validationQuery =从双重选择1
testWhileIdle = true
timeBetweenEvictionRunsMillis = 60000
}
}

我从其他应用程序借用了此代码,只是更改了网址和用户/密码。另一个应用运行正常,但是我的应用抛出了一个很长的异常,归结为这个

 由SQLNestedException引起:无法加载JDBC驱动程序类'oracle.jdbc.driver.OracleDriver'
堆栈跟踪
由ClassNotFoundException导致:oracle.jdbc.driver.OracleDriver

我已将ojdbc6.jar复制到我的应用程序li​​b /中,但恐怕我无法接受下一步做什么。



编辑我已将 oracle.jdbc.driver.OracleDriver 更新为 oracle.jdbc.OracleDriver ,但没有进展。所以,问题是@tim_yates建议的。从那以后,我的问题是,即使我刷新了依赖关系,正如@burt所说,但我从来没有重新加载配置文件。



我只是运行 grails clean 然后 grails compile --refresh-dependencies 和瞧,问题解决了。感谢@burt和@tim_yates帮助我解决问题。


I am trying to test a grails app connecting to a sql server, for now, I am using one of my own. This is my datasource.groovy

    dataSource {
        configClass = GrailsAnnotationConfiguration.class
        pooled = true
        driverClassName = "oracle.jdbc.driver.OracleDriver"
        dialect = "org.hibernate.dialect.Oracle10gDialect"
        dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
        url = "jdbc:oracle:thin:@127.0.0.1:1521/xe"
        username = "blah"
        password = "blah"
        properties {
            validationQuery="select 1 from dual"
            testWhileIdle=true
            timeBetweenEvictionRunsMillis=60000
        }
    }

I have borrowed this code from a different app, just changing the url and user/password. The other app runs fine, but my app throws a long exception, which boils down to this

Caused by SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
stack trace
Caused by ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I have copied ojdbc6.jar into my app lib/ but I am afraid I am lost on what to do next.

EDIT I have updated oracle.jdbc.driver.OracleDriver to oracle.jdbc.OracleDriver, but no progress

解决方案

So, turns out the problem was what @tim_yates suggested. The problem that I had since then was that even though I was refreshing the dependencies, as @burt said, but I had never re-loaded the config files.

I just ran grails clean then grails compile --refresh-dependencies and voila, problem solved. Thanks to @burt and @tim_yates for helping me out

这篇关于Groovy / Grails无法加载oracle.jdbc.driver.OracleDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆