WildFly无法为连接分叉新进程

时间:2021-05-23 03:03:09

I'm running simple OpenShift instance with WildFly app and PostgreSQL and constantly getting Caused by: org.postgresql.util.PSQLException: Connection rejected: could not fork new process for connection: Resource temporarily unavailable

我正在使用WildFly应用程序和PostgreSQL运行简单的OpenShift实例,并且不断受到以下问题:org.postgresql.util.PSQLException:连接被拒绝:无法为连接分叉新进程:资源暂时不可用

which I'm observing in my server.log

我在我的server.log中观察到的

How can I fix this? app trying to connect Postgre and get out of threads

我怎样才能解决这个问题?应用程序尝试连接Postgre并退出线程

my 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>

my 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>

1 个解决方案

#1


This is problem totally related to wrong clustering and messaging inside openshift settings. To fix it you will need to locate standalone.xml in .openshift/config/ and change clustering pools to lower values, along with messages pool look at the example below

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

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

#1


This is problem totally related to wrong clustering and messaging inside openshift settings. To fix it you will need to locate standalone.xml in .openshift/config/ and change clustering pools to lower values, along with messages pool look at the example below

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

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