I have an EJB application which uses JPA 2.0 on Glassfish 3.1.2 (provider is EclipseLink). When the database is down the application does not start and even more: can't be deployed. This is because EclipseLink does some initial verification.
Is there a way that the application can be deloyed and started even if the database is down?
Background: The resource being unavailable comes not into play until the first business function is called which accesses the database. From application startup till the first business function call there is a time window where the database may be started.
Changing the defaults in glassfish-resources.xml
for the attributes connection-creation-retry-attempts
and connection-creation-retry-interval-in-seconds
of <jdbc-connection-pool>
helps in some way but does still check the database availabilty at startup not at first use.
ExceptionHandler
from EclipseLink is not the way I have in mind: when the exception handler comes into play EclipseLink has already started the verification process and hence has tried to connect to the database. The way I am looking for is to postpone the verfification process itself until the first business call.