gpt4 book ai didi

oracle - 启动Grails应用程序时无法创建池的初始连接

转载 作者:行者123 更新时间:2023-12-02 15:25:49 26 4
gpt4 key购买 nike

我正在使用Oracle 11g。在开发模式下启动Grails应用程序时出现以下错误。我的DataSource.Groovy列在下面。请指教。

    Error |
2014-12-25 18:42:11,836 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initia
l connections of pool.
Message: oracle.jdbc.driver.OracleDriver

dataSource {
pooled = true
jmxExport = true
driverClassName = "oracle.jdbc.driver.OracleDriver"
username = "john"
password = "password"
}

更新:
我在Build.Groovy中有以下一行。但是该应用无法启动。所以我删除了它。我还需要插件吗?如果是这样,那应该是什么?
runtime ":com.oracle:ojdbc6:11.2.0.1.0"

更新-2

在我运行grails编译--refresh-dependencies并启动应用程序之后,现在出现以下错误。
Error |
2014-12-25 19:30:22,069 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error i
nitializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initia
lization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException
: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFacto
ry' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.fact
ory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference
to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframewo
rk.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve r
eference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Canno
t resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested excepti
on is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSo
urceUnproxied': Error setting property values; nested exception is org.springframework.beans.Propert
yBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean fai
led; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bea
n with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting be
an property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce
ption: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource'
while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.Bea
nCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'da
taSourceLazy' while setting constructor argument; nested exception is org.springframework.beans.fact
ory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Cannot resolve reference
to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springfram
ework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Erro
r setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateExceptio
n; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve
reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFact
ory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'dataSource': Cannot resolve reference to bean 'dataSourceLazy' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean wi
th name 'dataSourceLazy': Cannot resolve reference to bean 'dataSourceUnproxied' while setting const
ructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is or
g.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve refe
rence to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springf
ramework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot res
olve reference to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.
springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy':
Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested e
xception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '
dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.P
ropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve referenc
e to bean 'dataSourceLazy' while setting constructor argument; nested exception is org.springframewo
rk.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceLazy': Cannot resol
ve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is o
rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnp
roxied': Error setting property values; nested exception is org.springframework.beans.PropertyBatchU
pdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dataSourceLazy': Cannot resolve refe
rence to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.spri
ngframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied'
: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateEx
ception; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting
property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClas
sName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC dri
ver class [oracle.jdbc.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
Caused by PropertyBatchUpdateException: Failed properties: Property 'driverClassName' threw exceptio
n; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdb
c.driver.OracleDriver]
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run in java.lang.Thread
| Error Forked Grails VM exited with error

最佳答案

找不到带有JDBC驱动程序的Oracle jar。将文件放在grails项目的lib目录中。

将jar文件放在lib目录中时,不会自动发现该文件。跑

grails compile --refresh-dependencies

然后Grails会找到jar并将其添加到依赖项和类路径中。

关于oracle - 启动Grails应用程序时无法创建池的初始连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27651705/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com