Deploying WAR-Application in JBoss Wildfly with unavailable DataSource?

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 5, 2021.

  1. Stack

    Stack Membro Participativo

    I have a web application which uses JPA persistence under wildfly 8.2. The persistence.xml is connected to <jta-data-source>java:/jdbc/myDS</jta-data-source> which generally works fine.

    BUT if I start the JBoss-Server before the Database-Server is ready, the web application doesn't get deployed with the following error:

    BAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'my.war#myPU' is not available


    My wish is that the application DOES get deployed (and throws an exception when is accessed) even when the DB-server is not available. Is that possible?

    My datasource-definition:

    <datasource jndi-name="java:/jdbc/myDS" pool-name="myDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
    <driver>mysql</driver>
    <pool>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>15</max-pool-size>
    <prefill>true</prefill>
    </pool>
    <security>
    <user-name>myuser</user-name>
    <password>mypwd</password>
    </security>
    <validation>
    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
    <validate-on-match>false</validate-on-match>
    <background-validation>true</background-validation>
    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
    </validation>
    </datasource>


    Steps to reproduce:

    • Deploy an app with a "valid" datasource definition but keep the database server offline

    Continue reading...

Compartilhe esta Página