WildFly 无法分叉新的连接进程

WildFly could not fork new process for connection

我是 运行 带有 WildFly 应用程序和 PostgreSQL 的简单 OpenShift 实例,并且不断获得 Caused by: org.postgresql.util.PSQLException: Connection rejected: could not fork new process for connection: Resource temporarily unavailable

我正在 server.log

中观察

我该如何解决这个问题? 应用尝试连接 Postgre 并退出线程

我的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
             xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="
        http://xmlns.jcp.org/xml/ns/persistence
        http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="primary">
        <!-- The datasource is deployed as WEB-INF/tp-ds.xml, you
           can find it in the source at src/main/webapp/WEB-INF/tp-ds.xml -->
        <jta-data-source>java:jboss/datasources/PostgreSQLDS</jta-data-source>
        <properties>
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
            <property name="hibernate.show_sql" value="false" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
        </properties>

    </persistence-unit>
</persistence>

我的datasources.xml

<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
    <datasource jndi-name="java:jboss/datasources/TpDS"
                pool-name="TpDs" enabled="true"
                use-java-context="true">
        <connection-url>jdbc:h2:mem:tp;DB_CLOSE_DELAY=-1</connection-url>
        <driver>h2</driver>
        <security>
            <user-name>sa</user-name>
            <password>sa</password>
        </security>
    </datasource>
    <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">
        <connection-url>jdbc:postgresql://${env.OPENSHIFT_POSTGRESQL_DB_HOST}:${env.OPENSHIFT_POSTGRESQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
        <driver>postgresql</driver>
        <security>
            <user-name>${env.OPENSHIFT_POSTGRESQL_DB_USERNAME}</user-name>
            <password>${env.OPENSHIFT_POSTGRESQL_DB_PASSWORD}</password>
        </security>
    </datasource>
    <drivers>
        <driver name="postgresql" module="org.postgresql.jdbc">
            <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
        </driver>
    </drivers>
</datasources>

这个问题完全与 openshift 设置中错误的集群和消息传递有关。要修复它,您需要在 .openshift/config/ 中找到 standalone.xml 并将集群池和消息池更改为较低的值,请查看下面的示例

https://gist.github.com/sigrlami/9da34d3dd539dc6d7730