将 JHipster 与 Java 1.8 一起使用并使用 java build pack from cloudfoundry 部署到 Cloud Foundry ,遇到连接池大小的问题。我目前没有在应用程序级别设置它,并且认为它来自构建包。如何增加 JDBC 连接池大小。
其他详细信息: 我已将此作为问题记录在 jhipster-generator repo issues 上.
Caused by: org.hibernate.exception.GenericJDBCException: unable to obtain isolated JDBC connection
2015-01-29T13:42:24.95-0600 [App/0] OUT [ERROR] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - [jibberish] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:4; busy:4; idle:0; lastwait:30000].
最佳答案
早期的 JHipster 生成器使用 GenerationType.TABLE 在应用程序中创建实体。一旦将其更改为 GenerationType.AUTO 并将 Liquibase 架构更新为 autoIncrement="true",问题就会得到缓解,应用程序的性能将达到合理的预期。
相关代码如下:
坏的:
/**
* A EntityExample.
*/
@Entity
@Table(name = "T_ENTITYEXAMPLE")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class EntityExample implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
作品:
/**
* A EntityExample.
*/
@Entity
@Table(name = "T_ENTITYEXAMPLE")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class EntityExample implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
更新后的 XML (liquibase/changelog/timestamp_added_entity_EntityExample.xml)
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
关于java - 将 Java Webapp 部署到 Cloud Foundry 会产生 Pool Empty 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28284517/