details:   https://code.openbravo.com/erp/devel/pi/rev/3af494a7f094
changeset: 34462:3af494a7f094
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Jul 24 13:02:16 2018 +0200
summary:   related to issue 37064: fix error in export.database

  Add a check to ensure whether the external connection pool class is present 
in the classpath. This affects some ant tasks which are not able to load that 
class, and use the default Hibernate connection pool instead

diffstat:

 src/org/openbravo/dal/core/DalLayerInitializer.java |  12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r 3d151a1172b8 -r 3af494a7f094 
src/org/openbravo/dal/core/DalLayerInitializer.java
--- a/src/org/openbravo/dal/core/DalLayerInitializer.java       Tue Jul 24 
12:29:30 2018 +0200
+++ b/src/org/openbravo/dal/core/DalLayerInitializer.java       Tue Jul 24 
13:02:16 2018 +0200
@@ -31,6 +31,7 @@
 import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.base.session.SessionFactoryController;
 import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.database.ExternalConnectionPool;
 
 /**
  * This class is responsible for initializing the DAL layer. It ensures that 
the model is read in
@@ -131,7 +132,16 @@
   private boolean isUsingExternalConnectionPool() {
     String poolClassName = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
         .getProperty("db.externalPoolClassName");
-    return poolClassName != null && !"".equals(poolClassName);
+    if (poolClassName == null || "".equals(poolClassName)) {
+      return false;
+    }
+    try {
+      // check whether the external connection pool is present in the classpath
+      ExternalConnectionPool.getInstance(poolClassName);
+      return true;
+    } catch (ReflectiveOperationException | NoClassDefFoundError e) {
+      return false;
+    }
   }
 
   public boolean isInitialized() {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to