title: WSO2 API Manager Mysql database initialization
body: <p>I'm trying to change the carbon H2 database (for this test) for a MariaDB system. Once my master-datasources.xml and my databases created and configured thanks to the provided scripts, I start the API Manager but it fails with the following error :</p>
  
  <pre><code>ERROR - Activator Cannot start User Manager Core bundle
  June 1st 2018, 14:51:07.000 org.wso2.carbon.user.core.UserStoreException: Cannot initialize the realm.
  Caused by: org.wso2.carbon.user.core.UserStoreException: nullType class java.lang.reflect.InvocationTargetException
  June 1st 2018, 14:51:07.000 Caused by: org.wso2.carbon.user.core.UserStoreException: nullType class java.lang.reflect.InvocationTargetException
  Caused by: org.wso2.carbon.user.core.UserStoreException: Error occurred while checking is existing domain : PRIMARY for tenant : -123
  </code></pre>
  
  <p>I tried to use MariaDB only for the carbon database, using the following datasource config:</p>
  
  <pre><code>&lt;datasource&gt;
      &lt;name&gt;WSO2_CARBON_DB&lt;/name&gt;
      &lt;description&gt;The datasource used for registry and user manager&lt;/description&gt;
      &lt;jndiConfig&gt;
          &lt;name&gt;jdbc/WSO2CarbonDB&lt;/name&gt;
      &lt;/jndiConfig&gt;
      &lt;definition type="RDBMS"&gt;
          &lt;configuration&gt;
      &lt;url&gt;jdbc:mysql://wso2_mysql:3306/wso2_am_carbon;DB_CLOSE_ON_EXIT=FALSE&lt;/url&gt;
              &lt;username&gt;wso2carbon&lt;/username&gt;
              &lt;password&gt;wso2carbon&lt;/password&gt;
      &lt;!--&lt;driverClassName&gt;org.h2.Driver&lt;/driverClassName&gt;--&gt;
              &lt;maxActive&gt;50&lt;/maxActive&gt;
              &lt;maxWait&gt;60000&lt;/maxWait&gt;
              &lt;testOnBorrow&gt;true&lt;/testOnBorrow&gt;
              &lt;validationQuery&gt;SELECT 1&lt;/validationQuery&gt;
              &lt;validationInterval&gt;30000&lt;/validationInterval&gt;
          &lt;/configuration&gt;
      &lt;/definition&gt;
  &lt;/datasource&gt;
  </code></pre>
  
  <p>user-mgt.xml is using the correct datasource name :</p>
  
  <pre><code>&lt;Property name="dataSource"&gt;jdbc/WSO2CarbonDB&lt;/Property&gt;
  </code></pre>
  
  <p>and my database has been initialized with the dbscripts/mysql5.7.sql script. User permissions have been set correctly. </p>
  
  <p>Since after the failed start the database stays empty I guess there is a problem writing to it. So I tried to start the app with the -Dsetup parameter but no luck.</p>
  
  <p>Thank you.</p>