我们在应用程序中使用weblogic连接池。我们正在使用hibernate进行数据库访问。现在,当我们尝试从weblogic数据源获取连接时,它会抛出安全性异常。所以我们需要将weblogic凭证放在hibernate.properties中,如下所示。
hibernate.connection.username=weblogic
hibernate.connection.password=weblogic1
现在这个工作正常但是当我在hibernate.properties中加密密码然后我们在启动时解密密码设置为hibernate配置如下
String password = config.getProperty("hibernate.connection.password");
if (password != null) {
password = Cryptography.decryptIfNeeded(password);
config.setProperty("hibernate.connection.password",password);
}
一切正常,但在1小时或2小时之后我们开始geeting weblogic连接池耗尽问题。现在,当我删除上面的代码来解密密码并在hibernate中放置纯文本密码时,一切正常,即使我们保持环境几天也没有连接池耗尽。
我无法弄清楚问题的原因是什么。 在我们的应用程序中,我们有一个轮询器,它在10秒后保持轮询db表,轮询器开始获得连接池exahsuted错误。
PFB堆栈跟踪。
- 2014-01-21 00:00:01,104 [Thread-318:WorkProcessor$WorkRunner(WorkProcessor$WorkRunner:D:JobSchedulerDaemon:MAIN)] ERROR (support.context.SessionExecutable) Caught exception from SessionExecutable.execute()
- 2014-01-21 00:00:01,104 [Thread-318:WorkProcessor$WorkRunner(WorkProcessor$WorkRunner:D:JobSchedulerDaemon:MAIN)] ERROR (batch.scheduler.JobSchedulerDaemon) Exception encountered polling for batch jobs to run
com.splwg.shared.common.LoggedException:
The following stacked messages were reported as the LoggedException was rethrown:
com.splwg.base.support.context.ApplicationContext.createThreadBoundSession(ApplicationContext.java:523): Caught exception from SessionExecutable.execute()
The root LoggedException was: Error creating hibernate session
at com.splwg.shared.common.LoggedException.wrap(LoggedException.java:198)
at com.splwg.shared.common.LoggedException.wrap(LoggedException.java:85)
at com.splwg.base.support.context.ApplicationContext.newHibernateSession(ApplicationContext.java:497)
at com.splwg.base.support.context.FrameworkSession.initialize(FrameworkSession.java:228)
at com.splwg.base.support.context.FrameworkSession.<init>(FrameworkSession.java:212)
at com.splwg.base.support.context.ApplicationContext.createSession(ApplicationContext.java:459)
at com.splwg.base.support.context.ApplicationContext.createThreadBoundSession(ApplicationContext.java:523)
at com.splwg.base.support.context.SessionExecutable.doInReadOnlySession(SessionExecutable.java:101)
at com.splwg.base.support.context.SessionExecutable.doAsReadOnlyInCurrentSessionIfAvailable(SessionExecutable.java:65)
at com.splwg.base.support.context.SessionExecutable.doAsReadOnlyInCurrentSessionIfAvailable(SessionExecutable.java:57)
at com.splwg.base.support.batch.scheduler.PendingBatchJob.areThereBatchJobsToRun(PendingBatchJob.java:82)
at com.splwg.base.support.batch.scheduler.PendingBatchJob.nextPendingJob(PendingBatchJob.java:38)
at com.splwg.base.support.batch.scheduler.JobSchedulingPollIteration.execute(JobSchedulingPollIteration.java:34)
at com.splwg.base.support.batch.scheduler.JobSchedulerDaemon.performPollingWork(JobSchedulerDaemon.java:80)
at com.splwg.base.support.grid.space.PollingDaemon.doExecuteWork(PollingDaemon.java:55)
at com.splwg.base.support.batch.scheduler.JobSchedulerDaemon.doExecuteWork(JobSchedulerDaemon.java:67)
at com.splwg.base.support.grid.AbstractGridWork.executeWork(AbstractGridWork.java:69)
at com.splwg.base.support.grid.node.WorkProcessor$WorkRunner.runOutsideTransaction(WorkProcessor.java:257)
at com.splwg.base.support.grid.space.AbstractTask.run(AbstractTask.java:57)
at com.splwg.base.support.grid.space.ThreadPool$TaskRunner.run(ThreadPool.java:166)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74)
at $Proxy187.prepareStatement(Unknown Source)
at com.splwg.base.support.context.ApplicationContext.setNLSDateFormat(ApplicationContext.java:503)
at com.splwg.base.support.context.ApplicationContext.newHibernateSession(ApplicationContext.java:490)
... 19 more
Caused by: java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool FCBDataSource to allocate to applications, please increase the size of the pool and retry..
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:577)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:343)
at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:324)
at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:94)
at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:1677)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:446)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:403)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:364)
at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74)
at $Proxy187.prepareStatement(Unknown Source)
at com.splwg.base.support.context.ApplicationContext.newHibernateSession(ApplicationContext.java:490)
at com.splwg.base.support.context.FrameworkSession.initialize(FrameworkSession.java:228)
at com.splwg.base.support.context.ApplicationContext.createSession(ApplicationContext.java:463)
at com.splwg.base.support.context.ApplicationContext.createThreadBoundSession(ApplicationContext.java:523)
at com.splwg.base.support.context.SessionExecutable.doInReadOnlySession(SessionExecutable.java:101)
at com.splwg.base.support.context.SessionExecutable.doAsReadOnlyInCurrentSessionIfAvailable(SessionExecutable.java:65)
at com.splwg.base.support.context.SessionExecutable.doAsReadOnlyInCurrentSessionIfAvailable(SessionExecutable.java:57)
at com.splwg.base.support.batch.scheduler.PendingBatchJob.areThereBatchJobsToRun(PendingBatchJob.java:82)
at com.splwg.base.support.batch.scheduler.PendingBatchJob.nextPendingJob(PendingBatchJob.java:38)
at com.splwg.base.support.batch.scheduler.JobSchedulingPollIteration.execute(JobSchedulingPollIteration.java:34)
at com.splwg.base.support.batch.scheduler.JobSchedulerDaemon.performPollingWork(JobSchedulerDaemon.java:80)
at com.splwg.base.support.grid.space.PollingDaemon.doExecuteWork(PollingDaemon.java:59)
at com.splwg.base.support.batch.scheduler.JobSchedulerDaemon.doExecuteWork(JobSchedulerDaemon.java:67)
at com.splwg.base.support.grid.AbstractGridWork.executeWork(AbstractGridWork.java:69)
at com.splwg.base.support.grid.node.WorkProcessor$WorkRunner.runOutsideTransaction(WorkProcessor.java:257)
at com.splwg.base.support.grid.space.AbstractTask.run(AbstractTask.java:57)
at com.splwg.base.support.grid.space.ThreadPool$TaskRunner.run(ThreadPool.java:167)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1484)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:446)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:403)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:364)
at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:92)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
... 24 more