You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2016/09/07 11:25:57 UTC

ambari git commit: AMBARI-18326. Add custom jdbc path to ambari-server classpath.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/trunk 8755bf91e -> 3461a5c7c


AMBARI-18326. Add custom jdbc path to ambari-server classpath.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3461a5c7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3461a5c7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3461a5c7

Branch: refs/heads/trunk
Commit: 3461a5c7c53115e95afc48f5ef963a3c51caaa69
Parents: 8755bf9
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Wed Sep 7 14:24:22 2016 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Wed Sep 7 14:25:22 2016 +0300

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/orm/DBAccessorImpl.java | 10 ++++++++--
 .../main/python/ambari_server/dbConfiguration_linux.py    | 10 +++++-----
 2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3461a5c7/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index bb3f826..123fa96 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -105,9 +105,15 @@ public class DBAccessorImpl implements DBAccessor {
       dbmsHelper = loadHelper(databasePlatform);
       dbSchema = convertObjectName(configuration.getDatabaseSchema());
     } catch (Exception e) {
-      String message = "Error while creating database accessor ";
+      String message = "";
+      if (e instanceof ClassNotFoundException) {
+        message = "If you are using a non-default database for Ambari and a custom JDBC driver jar, you need to set property \"server.jdbc.driver.path={path/to/custom_jdbc_driver}\" " +
+                "in ambari.properties config file, to include it in ambari-server classpath.";
+      } else {
+        message = "Error while creating database accessor ";
+      }
       LOG.error(message, e);
-      throw new RuntimeException(e);
+      throw new RuntimeException(message,e);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3461a5c7/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index c595e41..429a36e 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -370,7 +370,7 @@ class PGConfig(LinuxDBMSConfig):
     self.database_url_pattern_alt = "jdbc:postgresql://{0}:{1}/{2}"
 
     self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-                                   'you must copy the {0} JDBC driver JAR file to {1}.'.format(
+                                   'you must copy the {0} JDBC driver JAR file to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.'.format(
         self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
     self._is_user_changed = False
@@ -788,7 +788,7 @@ class OracleConfig(LinuxDBMSConfig):
     self.database_url_pattern_alt = "jdbc:oracle:thin:@{0}:{1}:{2}"
 
     self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-                                   'you must copy the {0} JDBC driver JAR file to {1}.'.format(
+                                   'you must copy the {0} JDBC driver JAR file to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.'.format(
         self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
     self.init_script_file = AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-Oracle-CREATE.sql'")
@@ -899,7 +899,7 @@ class MySQLConfig(LinuxDBMSConfig):
     self.database_url_pattern_alt = "jdbc:mysql://{0}:{1}/{2}"
 
     self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-                                     'you must copy the {0} JDBC driver JAR file to {1}.'.format(
+                                     'you must copy the {0} JDBC driver JAR file to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.'.format(
     self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
     self.init_script_file = AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql")
@@ -977,7 +977,7 @@ class MSSQLConfig(LinuxDBMSConfig):
     self.database_url_pattern_alt = "jdbc:sqlserver://{0}:{1};databaseName={2}"
 
     self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-                                   'you must copy the {0} JDBC driver JAR file to {1}.'.format(
+                                   'you must copy the {0} JDBC driver JAR file to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.'.format(
       self.dbms_full_name, configDefaults.JAVA_SHARE_PATH)
 
     self.init_script_file = AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-SQLServer-CREATE.sql")
@@ -1034,7 +1034,7 @@ class SQLAConfig(LinuxDBMSConfig):
     self.database_url_pattern_alt = "jdbc:sqlanywhere:eng={0};dbf={1};host={2};port={3}"
 
     self.JDBC_DRIVER_INSTALL_MSG = 'Before starting Ambari Server, ' \
-                                   'you must copy the {0} jdbc client tarball to {1}.'.format(
+                                   'you must copy the {0} jdbc client tarball to {1} and set property "server.jdbc.driver.path=[path/to/custom_jdbc_driver]" in ambari.properties.'.format(
       self.dbms_full_name, configDefaults.SHARE_PATH)
 
     self.init_script_file = AmbariPath.get("/var/lib/ambari-server/resources/Ambari-DDL-SQLAnywhere-CREATE.sql")