我有一个Spring Boot应用程序集成了Hibernate Search来索引我的JPA实体,一切都在本地工作正常。我有以下组件来在应用程序启动时创建索引:
@Component
class SearchIndexBuilder implements ApplicationListener<ApplicationReadyEvent>{
@PersistenceContext
private EntityManager entityManager
void onApplicationEvent(ApplicationReadyEvent event) {
try {
FullTextEntityManager fullTextEntityManager =
Search.getFullTextEntityManager(entityManager);
fullTextEntityManager.createIndexer().startAndWait()
} catch (InterruptedException e) {
System.out.println(
"An error occurred trying to build the search index: " +
e.toString());
}
}
}
但是当我将我的应用程序部署到Pivotal Web Services时,MassIndexer失败并出现以下异常:
2016-03-21T14:33:33.91+0100 [APP/0] OUT org.hibernate.exception.GenericJDBCException: Could not open connection
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:235) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.run(IdentifierConsumerDocumentProducer.java:116) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.runWithErrorHandler(OptionallyWrapInJTATransaction.java:111) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.ErrorHandledRunnable.run(ErrorHandledRunnable.java:49) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [Hibernate Search: entityloader-6] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:4; busy:4; idle:0; lastwait:30000].
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:681) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:185) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT ... 9 common frames omitted
2016-03-21T14:33:33.91+0100 [APP/0] OUT 2016-03-21 13:33:33.913 ERROR 16 --- [ entityloader-2] o.h.s.exception.impl.LogErrorHandler : HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation
2016-03-21T14:33:33.91+0100 [APP/0] OUT org.hibernate.exception.GenericJDBCException: Could not open connection
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:235) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.IdentifierConsumerDocumentProducer.run(IdentifierConsumerDocumentProducer.java:116) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.runWithErrorHandler(OptionallyWrapInJTATransaction.java:111) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.ErrorHandledRunnable.run(ErrorHandledRunnable.java:49) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_73-]
2016-03-21T14:33:33.91+0100 [APP/0] OUT Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [Hibernate Search: entityloader-2] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:4; busy:4; idle:0; lastwait:30000].
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:681) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:185) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.91+0100 [APP/0] OUT ... 9 common frames omitted
2016-03-21T14:33:33.92+0100 [APP/0] OUT 2016-03-21 13:33:33.921 WARN 16 --- [ntifierloader-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: null
2016-03-21T14:33:33.92+0100 [APP/0] OUT 2016-03-21 13:33:33.922 ERROR 16 --- [ntifierloader-1] o.h.engine.jdbc.spi.SqlExceptionHelper : [Hibernate Search: identifierloader-1] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:4; busy:4; idle:0; lastwait:30000].
2016-03-21T14:33:33.92+0100 [APP/0] OUT 2016-03-21 13:33:33.922 ERROR 16 --- [ntifierloader-1] o.h.s.exception.impl.LogErrorHandler : HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation
2016-03-21T14:33:33.92+0100 [APP/0] OUT org.hibernate.exception.GenericJDBCException: Could not open connection
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:235) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:171) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.IdentifierProducer.inTransactionWrapper(IdentifierProducer.java:110) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.IdentifierProducer.run(IdentifierProducer.java:95) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.runWithErrorHandler(OptionallyWrapInJTATransaction.java:114) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.search.batchindexing.impl.ErrorHandledRunnable.run(ErrorHandledRunnable.java:49) ~[hibernate-search-orm-4.5.3.Final.jar!/:4.5.3.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_73-]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_73-]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_73-]
2016-03-21T14:33:33.92+0100 [APP/0] OUT Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [Hibernate Search: identifierloader-1] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:4; busy:4; idle:0; lastwait:30000].
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:681) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:185) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) ~[tomcat-jdbc-8.0.30.jar!/:na]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:380) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:228) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final]
2016-03-21T14:33:33.92+0100 [APP/0] OUT ... 10 common frames omitted
2016-03-21T14:33:33.93+0100 [APP/0] OUT 2016-03-21 13:33:33.933 INFO 16 --- [ main] o.h.s.i.SimpleIndexingProgressMonitor : HSEARCH000028: Reindexed 0 entities
我尝试将我的ClearDB计划从Spark升级到Boost,这将DB上的最大连接数从4增加到15,但它没有改变任何内容。
知道我缺少什么吗?