You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When DB server is restarted, quartz is unable to connect it back even when DB server is up and running again.
quartz keeps on throwing the below error even when DB server is up:
QuartzScheduler_OtmmScheduler-HMENGAREDH3NWG31715062741536_ClusterManager 2024-05-07 11:51:26,255 | ERROR | session= | user= | org.quartz.impl.jdbcjobstore.JobStoreCMT | ClusterManager: Error managing cluster: Failed to obtain DB connection from data source 'otmm-no-tx': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:openejb/Resource/jdbc/scheduler-db-no-tx' javax.naming.NameNotFoundException: Name [openejb/Resource/jdbc/scheduler-db-no-tx] is not bound in this Context. Unable to find [openejb].
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'otmm-no-tx': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:openejb/Resource/jdbc/scheduler-db-no-tx' javax.naming.NameNotFoundException: Name [openejb/Resource/jdbc/scheduler-db-no-tx] is not bound in this Context. Unable to find [openejb].
at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) ~[quartz-2.3.2.jar:?]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3322) ~[quartz-2.3.2.jar:?]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3935) ~[quartz-2.3.2.jar:?]
at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.run(JobStoreSupport.java:3972) ~[quartz-2.3.2.jar:?]
Caused by: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:openejb/Resource/jdbc/scheduler-db-no-tx' javax.naming.NameNotFoundException: Name [openejb/Resource/jdbc/scheduler-db-no-tx] is not bound in this Context. Unable to find [openejb].
at org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:163) ~[quartz-2.3.2.jar:?]
at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) ~[quartz-2.3.2.jar:?]
at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ~[quartz-2.3.2.jar:?]
... 3 more
Analysis:
This issue is seen only in TomEE server and not in JBOSS.
This issue is reproducible in postgres as well as Microsoft SQL server DB.
Once the DB server is down, datasource object of org.quartz.utils.JNDIConnectionProvider is made null in catch block during the execution of getConnection() method.
catch (Exception e) {
this.datasource = null;
throw new SQLException(
"Could not retrieve datasource via JNDI url '" + url + "' "
+ e.getClass().getName() + ": " + e.getMessage());
Now since datasource object is null, trying to retrieve this datasource object from context when getConnection() method is executed again.
if (ds == null || isAlwaysLookup()) {
ctx = (props != null) ? new InitialContext(props): new InitialContext();
ds = ctx.lookup(url);
if (!isAlwaysLookup()) {
this.datasource = ds;
}
}
In above if block while executing ctx.lookup(url) below exception is thrown: javax.naming.NameNotFoundException: Name [openejb/Resource/jdbc/scheduler-db-no-tx] is not bound in this Context. Unable to find [openejb].
However, this same logic is used in init() method to get datasource object at the time of intialization, but here no exception is thrown.
Seems that TomEE has some strange behavior of removing/deleting the datasource when its connections are gone bad? Is this configurable behavior of TomEE?
Description:
When DB server is restarted, quartz is unable to connect it back even when DB server is up and running again.
quartz keeps on throwing the below error even when DB server is up:
Analysis:
javax.naming.NameNotFoundException: Name [openejb/Resource/jdbc/scheduler-db-no-tx] is not bound in this Context. Unable to find [openejb].
Software version used:
quartz - 2.3.2
TomEE - 8.0.13
Postgresql - 6.12
The text was updated successfully, but these errors were encountered: