If, for any reason, no jdbc connection is available, I get the following 
exception with stacktrace.

2024-03-26 09:34:59,614 ERROR 
[org.apache.activemq.artemis.jdbc.store.drivers.JDBCConnectionProvider]
SQL EXCEPTIONS:
SQLState: 08006 ErrorCode: 17002 Message: IO Error: The Network Adapter could 
not establish the connection (CONNECTION_ID=b+bm+NCuRfSpy8KMoO0r0A==)
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not 
establish the connection (CONNECTION_ID=b+bm+NCuRfSpy8KMoO0r0A==)
  at 
oracle.jdbc.driver.T4CConnection.handleLogonNetException(T4CConnection.java:902)
  at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:707)
  at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:1094)
  at 
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:89)
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:732)
  at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:648)
  at 
org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:55)
  at 
org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355)
  at 
org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:889)
  at 
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:424)
  at 
org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:349)
  at 
org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:134)
  at 
org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
  at 
org.apache.activemq.artemis.jdbc.store.drivers.JDBCConnectionProvider.getConnection(JDBCConnectionProvider.java:62)
  at 
org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl.sync(JDBCJournalImpl.java:215)
  at 
org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl$JDBCJournalSync.run(JDBCJournalImpl.java:1011)
  at 
org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.runForExecutor(ActiveMQScheduledComponent.java:314)
  at 
org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent.lambda$bookedRunForScheduler$2(ActiveMQScheduledComponent.java:321)
  at 
org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:57)
  at 
org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
  at 
org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
  at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  at 
org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)

Artemis then decides in the method 
org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.DefaultCriticalErrorListener.onIOException(Throwable,
 String, String) which is called by 
org.apache.activemq.artemis.jdbc.store.journal.JDBCJournalImpl.handleException(List<JDBCJournalRecord>,
 Throwable) to stop the server but unfortunately the jvm then terminates with 
success instead of failure which can then not be detected by restart handlers 
of container administration tools like docker-compose, podman, Kubernetes, etc.


-----Ursprüngliche Nachricht-----
Von: Clebert Suconic <clebert.suco...@gmail.com> 
Gesendet: Samstag, 23. März 2024 23:05
An: users@activemq.apache.org
Betreff: Re: Exit code in case of failure

It’s not the critical analyzer.  It’s the critical IO Error

An IO exception happened and it goes to the exception listener.

On Sat, Mar 23, 2024 at 1:55 PM Domenico Francesco Bruscino < 
bruscin...@gmail.com> wrote:

> Hi Reto,
>
> can you share the stacktrace of the error that you are facing?
>
> Regards,
> Domenico
>
> On Thu, 21 Mar 2024 at 08:53, Urfer Reto <reto.ur...@profidata.com> wrote:
>
> > Hi Domenico
> >
> > Unfortunately your proposal does not work in our case. It seems that 
> > the error handling of a missing JDBC connection is different and is 
> > not done
> by
> > the critical analyzer
> >
> > Regards
> > REto
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Domenico Francesco Bruscino <bruscin...@gmail.com>
> > Gesendet: Mittwoch, 20. März 2024 14:56
> > An: users@activemq.apache.org
> > Betreff: Re: Exit code in case of failure
> >
> > Hi Reto,
> >
> > you could use use the HALT critical analyzer policy to force artemis 
> > to exit with the exit code 70, i.e.
> > <critical-analyzer-policy>HALT</critical-analyzer-policy>
> >
> > Regards,
> > Domenico
> >
> >
> > On Wed, 20 Mar 2024 at 12:17, Urfer Reto <reto.ur...@profidata.com>
> wrote:
> >
> > > Hi
> > >
> > > We are using activemq artemis 2.31.2 as a container managed by 
> > > docker-compose/podman. For persistence we have to use JDBC. If, 
> > > for any reason (eventually a short network unavailablility), 
> > > artemis fails to get the JDBC connection it executes a graceful 
> > > shutdown and exists with 0
> > > (SUCCESS) instead of 1 (FAILURE). Therefore docker-compose does 
> > > not restart the artemis container though we have defined the 
> > > restart policy to restart the container in case of failure.
> > >
> > > Is there any way to tell artemis to exit with a failure exit code 
> > > in case it detects a fatal error like not getting a JDBC connection?
> > >
> > > Regards
> > > Reto
> > >
> > > ----------------------------
> > > Profidata AG
> > > Reto Urfer
> > > Senior Software Engineer
> > >
> > > Bändliweg 30
> > > 8048 Zürich
> > > Switzerland
> > > +41 44 736 47 47
> > > reto.ur...@profidata.com<mailto:reto.ur...@profidata.com>
> > > www.profidata.com<http://www.profidata.com/>
> > > ----------------------------
> > > Profidata Group
> > > Investment Management Solutions
> > > ----------------------------
> > >
> > > CONFIDENTIALITY NOTICE: If you are not the intended recipient, 
> > > please notify the sender immediately and delete this e-mail.
> > > Notice concerning e-mail data protection< 
> > > https://www.profidatagroup.com/disclaimer#e-mail-disclaimer>
> > >
> > >
> >
>

Reply via email to