Deploying WAR-Application in JBoss Wildfly with unavailable DataSource?

不羁的心 提交于 2020-01-01 15:07:35

问题


I´ve a webapplication wich uses JPA persistence unter wildfly 8.2. The persistence.xml is connected to <jta-data-source>java:/jdbc/myDS</jta-data-source> wich generally works fine.

BUT if I start the JBoss-Server before the Database-Server is ready, the web application doen´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

来源:https://stackoverflow.com/questions/33775169/deploying-war-application-in-jboss-wildfly-with-unavailable-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!