本文介绍了无法在Grails中创建池问题的初始连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的高级创建了一个远程的oracle JDBC,我必须连接到特定的WiFi来访问数据库方案。即使我配置我的DataSource.groovy如下:

  dataSource {
pooled = true
jmxExport = true
driverClassName =oracle.jdbc.OracleDriver
username =test
password =pass}

hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
}

environments {
development {
dataSource {
dbCreate =create-drop/ /'create','create-drop','update','validate',''
url =jdbc:oracle:thin:@ 10.42.0.1:1521:xe
username =test
password =pass
driverClassName =oracle.jdbc.OracleDriver
dialect = imocha.hibernate.dialect.Oracle11gDialect
}
}
test {
dataSource {
dbCreate =update
url =jdbc:oracle:thin:@ 10.42.0.1:1521:xe
username =test
password =pass
driverClassName = oracle.jdbc.OracleDriver
dialect = imocha.hibernate.dialect.Oracle11gDialect
}
}
生产{
dataSource {
dbCreate =update
url =jdbc:oracle:thin:@ 10.42.0.1:1521:xe
username =test
password =pass
driverClassName =oracle。 jdbc.OracleDriver
dialect = imocha.hibernate.dialect.Oracle11gDialect
properties {
//请参阅http://grails.org/doc/latest/guide/conf.html#dataSource for文档
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery =SELECT 1
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors =ConnectionState
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}


但它仍然显示无法创建池问题的初始连接在Grails中。我已经清除了我的Grails中的代理(我工作的地方需要代理连接到WiFi),因为我的高级代理会影响Grails中的连接。我想知道我无法连接到远程数据库的原因是什么。



我附上了下面的错误日志:

  |错误2017-04-21 17:26:05,744 [localhost-startStop-1]错误pool.ConnectionPool  - 无法创建池的初始连接。 
消息:oracle.jdbc.OracleDriver
Line |方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由ClassNotFoundException引起:oracle.jdbc.OracleDriver
- >> 366 |在java.net.URLClassLoader中运行$ 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 |在''
|运行354 | java.net.URLClassLoader
中的findClass 425 | java.lang.ClassLoader中的loadClass
| 274 | forName。在java.lang.Class
|中262 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |中运行跑 。 。 。在java.lang.Thread
|中错误2017-04-21 17:26:06,330 [localhost-startStop-1]错误pool.ConnectionPool - 无法创建池的初始连接。
消息:oracle.jdbc.OracleDriver
Line |方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由ClassNotFoundException引起:oracle.jdbc.OracleDriver
- >> 366 |在java.net.URLClassLoader中运行$ 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 |在''
|运行354 | java.net.URLClassLoader
中的findClass 425 | java.lang.ClassLoader中的loadClass
| 274 | forName。在java.lang.Class
|中262 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |中运行跑 。 。 。在java.lang.Thread
|中错误2017-04-21 17:26:06,917 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - 初始化应用程序时出错:创建名为'transactionManagerPostProcessor'的bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
消息:使用名称'transactionManagerPostProcessor'创建bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
行|方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用。嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由MetaDataAccessException引发:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由SQLException引发:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由ClassNotFoundException引起:oracle.jdbc.OracleDriver
- >> 366 |在java.net.URLClassLoader中运行$ 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 |在''
|运行354 | java.net.URLClassLoader
中的findClass 425 | java.lang.ClassLoader中的loadClass
| 274 | forName。在java.lang.Class
|中262 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |中运行跑 。 。 。在java.lang.Thread
|中错误2017-04-21 17:26:07,185 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - 初始化Grails时出错:创建名为'transactionManagerPostProcessor'的bean时出错:Bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
消息:使用名称'transactionManagerPostProcessor'创建bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
行|方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用。嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由MetaDataAccessException引发:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由SQLException引发:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由ClassNotFoundException引起:oracle.jdbc.OracleDriver
- >> 366 |在java.net.URLClassLoader中运行$ 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 |在''
|运行354 | java.net.URLClassLoader
中的findClass 425 | java.lang.ClassLoader中的loadClass
| 274 | forName。在java.lang.Class
|中262 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |中运行跑 。 。 。在java.lang.Thread
|中错误2017-04-21 17:26:07,283 [localhost-startStop-1] ERROR [localhost]。[/ testDB] - 将异常发送上下文初始化事件给类org.codehaus.groovy.grails.web.context的监听器实例。 GrailsContextLoaderListener
消息:创建名为'transactionManagerPostProcessor'的bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
行|方法
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用。嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由BeanCreationException引发:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套的异常是org.springframework.jdbc.support.MetaDataAccessException:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由MetaDataAccessException引发:提取DatabaseMetaData时出错;嵌套异常是java.sql.SQLException:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由SQLException引发:oracle.jdbc.OracleDriver
- >> 262 |运行于java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |跑 。 。 。在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |在java.lang.Thread中运行
由ClassNotFoundException引起:oracle.jdbc.OracleDriver
- >> 366 |在java.net.URLClassLoader中运行$ 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 355 |在''
|运行354 | java.net.URLClassLoader
中的findClass 425 | java.lang.ClassLoader中的loadClass
| 274 | forName。在java.lang.Class
|中262 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 |中运行跑 。 。 。在java.lang.Thread
|中错误2017-04-21 17:26:07,399 [localhost-startStop-1]错误core.StandardContext - 错误listenerStart
|错误2017-04-21 17:26:07,446 [localhost-startStop-1]错误core.StandardContext - 上下文[/ testDB]由于前面的错误导致启动失败

谢谢。



PS我正在使用Grails 2



是应用程序类路径中的ojdbcXX.jar根据您使用的Oracle版本(似乎是11),您可能只需要更改驱动程序包名称:




$ b

  driverClassName =oracle.jdbc.driver.OracleDriver



  driverClassName:'oracle.jdbc.OracleDriver'


My senior created a remote oracle JDBC, I have to connect to specific WiFi to access the database scheme. Even though I configure my DataSource.groovy as below:

dataSource {
pooled = true
jmxExport = true
driverClassName = "oracle.jdbc.OracleDriver"
username = "test"
password = "pass"}

hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
}

environments {
development {
    dataSource {
        dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
        url = "jdbc:oracle:thin:@10.42.0.1:1521:xe"
        username = "test"
        password = "pass"
        driverClassName = "oracle.jdbc.OracleDriver"
        dialect = imocha.hibernate.dialect.Oracle11gDialect
    }
}
test {
    dataSource {
        dbCreate = "update"
        url = "jdbc:oracle:thin:@10.42.0.1:1521:xe"
        username = "test"
        password = "pass"
        driverClassName = "oracle.jdbc.OracleDriver"
        dialect = imocha.hibernate.dialect.Oracle11gDialect
    }
}
production {
    dataSource {
        dbCreate = "update"
        url = "jdbc:oracle:thin:@10.42.0.1:1521:xe"
        username = "test"
        password = "pass"
        driverClassName = "oracle.jdbc.OracleDriver"
        dialect = imocha.hibernate.dialect.Oracle11gDialect
        properties {
           // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
           jmxEnabled = true
           initialSize = 5
           maxActive = 50
           minIdle = 5
           maxIdle = 25
           maxWait = 10000
           maxAge = 10 * 60000
           timeBetweenEvictionRunsMillis = 5000
           minEvictableIdleTimeMillis = 60000
           validationQuery = "SELECT 1"
           validationQueryTimeout = 3
           validationInterval = 15000
           testOnBorrow = true
           testWhileIdle = true
           testOnReturn = false
           jdbcInterceptors = "ConnectionState"
           defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
        }
    }
} 

But it still shows unable to create initial connections of pool issues in Grails. I have cleared the proxy in my Grails (the place I working require proxy to connect to WiFi) as my senior say proxy will affect the connection in Grails. I would like to know what is the reason that I can't connect to remote database.

I have attached the error logs below:

| Error 2017-04-21 17:26:05,744 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: oracle.jdbc.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
^    745 | run       in java.lang.Thread
Caused by ClassNotFoundException: oracle.jdbc.OracleDriver
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    274 | forName . in java.lang.Class
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread
| Error 2017-04-21 17:26:06,330 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: oracle.jdbc.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
^    745 | run       in java.lang.Thread
Caused by ClassNotFoundException: oracle.jdbc.OracleDriver
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    274 | forName . in java.lang.Class
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread
| Error 2017-04-21 17:26:06,917 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.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
^    745 | 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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by ClassNotFoundException: oracle.jdbc.OracleDriver
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    274 | forName . in java.lang.Class
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread
| Error 2017-04-21 17:26:07,185 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.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
^    745 | 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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by ClassNotFoundException: oracle.jdbc.OracleDriver
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    274 | forName . in java.lang.Class
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread
| Error 2017-04-21 17:26:07,283 [localhost-startStop-1] ERROR [localhost].[/testDB]  - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.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
^    745 | 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 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by SQLException: oracle.jdbc.OracleDriver
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread
Caused by ClassNotFoundException: oracle.jdbc.OracleDriver
->>  366 | run       in java.net.URLClassLoader$1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    355 | run       in     ''
|    354 | findClass in java.net.URLClassLoader
|    425 | loadClass in java.lang.ClassLoader
|    274 | forName . in java.lang.Class
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread
| Error 2017-04-21 17:26:07,399 [localhost-startStop-1] ERROR core.StandardContext  - Error listenerStart
| Error 2017-04-21 17:26:07,446 [localhost-startStop-1] ERROR core.StandardContext  - Context [/testDB] startup failed due to previous errors

Thank you.

PS I am using Grails 2

解决方案

You're getting a ClassNotFoundException: oracle.jdbc.driver.OracleDriver

Is your ojdbcXX.jar on the application's classpath?

Depending on the version of Oracle you're using (seems to be 11) you may just need to change the driver package name from:

driverClassName = "oracle.jdbc.driver.OracleDriver"

To

driverClassName: 'oracle.jdbc.OracleDriver'

这篇关于无法在Grails中创建池问题的初始连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 19:22