简体   繁体   中英

Deploying Java Webapp to Cloud Foundry produces Pool Empty error

Using JHipster with Java 1.8 and deploying to Cloud Foundry with the java build pack from cloudfoundry , running into an issue with connection pool sizes. I don't set it at the application level currently, and figure it's coming from the build pack. How do I increase the JDBC connection Pool size.

Additional Details : I have logged this as an issue on the 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].

Early generations of the JHipster Generator used GenerationType.TABLE for creating entities in the application. Once this was changed to GenerationType.AUTO with updating the Liquibase schema's to autoIncrement="true" then the issue was relieved and the application performs at reasonable expectations.

Here's the related code:

BAD:

/**
 * 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;

WORKS:

/**
 * 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;

The updated XML (liquibase/changelog/timestamp_added_entity_EntityExample.xml)

<column name="id" type="bigint" autoIncrement="true">
    <constraints primaryKey="true" nullable="false"/>
</column>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM