我在 stackoverflow 上问了这个问题,有人建议我在这里问。我有一个连接到几个 Oracle 11g 数据库的项目。所以我有 3 个不同的登录名。当我从我的 grails ide 本地运行它时,这很好。一开始启动它很困难,但它有效。最初我的问题与 hibernate 版本有关。目前是 3.6.10.10。现在我的问题是将它部署到测试服务器。使用的服务器是 Oracle iPlanet Web Server 7.0.15。我的 datasource.groovy 中有以下内容,错误随之而来。
dataSource {
dialect = org.hibernate.dialect.Oracle10gDialect
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1 from dual"
}
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
showsql = true
}
environments {
development {
dataSource {
url = "jdbc:oracle:oci:@database.whatever.com"
username="data_user"
password = "some_pw"
driverClassName = 'oracle.jdbc.OracleDriver'
}
dataSource_task {
url = "jdbc:oracle:oci8:@someotherdatabase.whatever.com"
username="other_user"
password = "other_pw"
driverClassName = 'oracle.jdbc.OracleDriver'
}
}
}
这不是完整的堆栈跟踪。由于大小限制,我不得不将我认为相关的内容放在这里。
[02/Dec/2014:14:52:24] info : stdout: 2014-12-02 14:52:24,569 [main] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
[02/Dec/2014:14:52:24] info : stdout: java.sql.SQLRecoverableException: Closed Connection
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:689)
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:401)
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:148)
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
[02/Dec/2014:14:52:24] info : stdout: at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:486)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:144)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:116)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:103)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.afterPropertiesSet(LazyConnectionDataSourceProxy.java:162)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy.<init>(LazyConnectionDataSourceProxy.java:106)
[02/Dec/2014:14:52:24] info : stdout: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[02/Dec/2014:14:52:24] info : stdout: at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[02/Dec/2014:14:52:24] info : stdout: at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[02/Dec/2014:14:52:24] info : stdout: at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:277)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:123)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:645)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:145)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:123)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:123)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:123)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.orm.support.TransactionManagerPostProcessor.initialize(TransactionManagerPostProcessor.java:74)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.orm.support.TransactionManagerPostProcessor.setBeanFactory(TransactionManagerPostProcessor.java:52)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1532)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1500)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:123)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:720)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:156)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:169)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:122)
[02/Dec/2014:14:52:24] info : stdout: at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:108)
[02/Dec/2014:14:52:24] info : stdout: at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4476)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.StandardContext.start(StandardContext.java:5133)
[02/Dec/2014:14:52:24] info : stdout: at com.sun.webserver.connector.nsapi.WebModule.start(WebModule.java:240)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1224)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.StandardHost.start(StandardHost.java:924)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1224)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:520)
[02/Dec/2014:14:52:24] info : stdout: at org.apache.catalina.startup.Embedded.start(Embedded.java:917)
[02/Dec/2014:14:52:24] info : stdout: at com.sun.enterprise.web.PwcWebContainer.onStartup(PwcWebContainer.java:70)
[02/Dec/2014:14:52:24] info : stdout: at com.sun.webserver.connector.nsapi.WebContainer.start(WebContainer.java:497)
[02/Dec/2014:14:52:24] info : stdout: at com.sun.webserver.init.J2EERunner.confPostInit(J2EERunner.java:304)
[02/Dec/2014:14:52:24] info : stdout: 2014-12-02 14:52:24,632 [main] ERROR context.GrailsContextLoader - 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 'lobHandlerDetector' while setting bean property 'lobHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lobHandlerDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLRecoverableException: Closed Connection
有什么建议么?
答案1
感谢一位同事,我发现问题出在我的程序启动脚本上。它必须指向服务器上的 jdk 主目录。它现在正在运行。