1
votes

I'm using WSO2 Identity Server 5.0 with Service Pack WSO2-IS-5.0.0-SP01 installed on two servers to form a cluster, set up all along the guide https://docs.wso2.com/display/CLUSTER420/Clustering+Identity+Server but I encounter the following error when starting the nodes:

{org.wso2.carbon.identity.user.store.remote.internal.CarbonRemoteUserStoreDSComponent} -  Carbon Remote User Store activated successfully.
[2015-08-31 16:34:52,777]  INFO {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  Configured Registry in 195ms
[2015-08-31 16:34:52,970]  INFO {org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService} -  Configured Registry in 1ms
[2015-08-31 16:34:53,107] ERROR {org.wso2.carbon.registry.core.dataaccess.TransactionManager} -  Failed to commit transaction.
java.sql.SQLException: Total number of available connections are less than the total number of committed connections
        at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.commit(JDBCDatabaseTransaction.java:1227)

My file /opt/WSO2/wso2is-5.0.0/repository/conf/registry.xml configuration:

    <currentDBConfig>sharedregistry</currentDBConfig>
    <readOnly>false</readOnly>
    <enableCache>true</enableCache>
    <registryRoot>/</registryRoot>

<dbConfig name="sharedregistry">
        <dataSource>jdbc/WSO2RegistryDB</dataSource>
</dbConfig>

<remoteInstance url="https://localhost:9443/registry">
        <id>instanceid</id>
        <dbConfig>sharedregistry</dbConfig>
        <readOnly>false</readOnly>
        <enableCache>true</enableCache>
        <registryRoot>/</registryRoot>
    </remoteInstance>


    <mount path="/_system/config" overwrite="true">
        <instanceId>instanceid</instanceId>
        <targetPath>/_system/nodes</targetPath>
    </mount>
    <mount path="/_system/governance" overwrite="true">
        <instanceId>instanceid</instanceId>
        <targetPath>/_system/governance</targetPath>
    </mount>

My file /opt/WSO2/wso2is-5.0.0/repository/conf/datasources/master-datasources.xml configuration:

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
     <providers> 
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
    </providers> 
    <datasources> 
        <datasource> 
            <name>REGISTRY_LOCAL1</name> 
            <description>The datasource used for registry-local</description> 
            <jndiConfig> 
                <name>jdbc/WSO2CarbonDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_LOCAL1?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</password> 
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                    <maxActive>50</maxActive> 
                    <maxWait>60000</maxWait> 
                    <testOnBorrow>true</testOnBorrow> 
                    <validationQuery>SELECT 1</validationQuery> 
                    <validationInterval>30000</validationInterval> 
                </configuration> 
            </definition> 
        </datasource> 
        <datasource> 
            <name>REGISTRY_DB</name> 
            <description>The datasource used for registry-config/governance</description> 
            <jndiConfig> 
                <name>jdbc/WSO2RegistryDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</password> 
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                    <maxActive>50</maxActive> 
                    <maxWait>60000</maxWait> 
                    <testOnBorrow>true</testOnBorrow> 
                    <validationQuery>SELECT 1</validationQuery> 
                    <validationInterval>30000</validationInterval> 
                </configuration> 
            </definition> 
        </datasource> 
        <datasource> 
           <name>WSO2_USER_DB</name> 
           <description>The datasource used for registry and user manager</description> 
           <jndiConfig> 
               <name>jdbc/WSO2UMDB</name> 
           </jndiConfig> 
           <definition type="RDBMS"> 
               <configuration> 
                   <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                   <username>regadmin</username> 
                   <password>regadmin</password> 
                   <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                   <maxActive>50</maxActive> 
                   <maxWait>60000</maxWait> 
                   <testOnBorrow>true</testOnBorrow> 
                   <validationQuery>SELECT 1</validationQuery> 
                   <validationInterval>30000</validationInterval> 
               </configuration> 
           </definition> 
        </datasource> 
   </datasources> 
</datasources-configuration>

DB create in MySQL:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| REGISTRY_DB        |
| REGISTRY_LOCAL1    |
| WSO2_USER_DB       |
| mysql              |
| performance_schema |
| regdb              |
| sharedreg_db       |
+--------------------+
8 rows in set (0.00 sec)

mysql>

Thanks in advance,

1

1 Answers

1
votes

Don't change the currentDBConfig. Leave it as it is. The registry mounting configurations mentioned in the above documentation must be added in addition to the existing currentDBConfig.

<currentDBConfig>wso2registry</currentDBConfig>
<readOnly>false</readOnly>
<enableCache>true</enableCache>
<registryRoot>/</registryRoot>

<dbConfig name="wso2registry">
   <dataSource>jdbc/WSO2CarbonDB</dataSource>
</dbConfig>

<dbConfig name="sharedregistry">
   <dataSource>jdbc/WSO2RegistryDB</dataSource>
</dbConfig>

<remoteInstance url="https://localhost:9443/registry">
   <id>instanceid</id>
   <dbConfig>sharedregistry</dbConfig>
   <readOnly>false</readOnly>
   <enableCache>true</enableCache>
   <registryRoot>/</registryRoot>
</remoteInstance>

<mount path="/_system/config" overwrite="true">
   <instanceId>instanceid</instanceId>
   <targetPath>/_system/nodes</targetPath>
</mount>
<mount path="/_system/governance" overwrite="true">
   <instanceId>instanceid</instanceId>
   <targetPath>/_system/governance</targetPath>
</mount>

The document you followed needs to be corrected. You can find a correct document here [1] for WSO2 API Manager. Do the above changes and restart the server. It should fix your issue.

Additionally, you can use the embedded H2 database for local registry as we are not going to share the local registry with other nodes in the cluster . So your master-datasources.xml can be changed as below.

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration"> 
     <providers> 
        <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider> 
    </providers> 
    <datasources> 
        <datasource>
            <name>WSO2_CARBON_DB</name>
            <description>The datasource used for registry and user manager</description>
            <jndiConfig>
                <name>jdbc/WSO2CarbonDB</name>
            </jndiConfig>
            <definition type="RDBMS">
                <configuration>
                    <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
                    <username>wso2carbon</username>
                    <password>wso2carbon</password>
                    <driverClassName>org.h2.Driver</driverClassName>
                    <maxActive>50</maxActive>
                    <maxWait>60000</maxWait>
                    <testOnBorrow>true</testOnBorrow>
                    <validationQuery>SELECT 1</validationQuery>
                    <validationInterval>30000</validationInterval>
                </configuration>
            </definition>
        </datasource>
        <datasource> 
            <name>REGISTRY_DB</name> 
            <description>The datasource used for registry-config/governance</description> 
            <jndiConfig> 
                <name>jdbc/WSO2RegistryDB</name> 
            </jndiConfig> 
            <definition type="RDBMS"> 
                <configuration> 
                    <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/REGISTRY_DB?autoReconnect=true</url> 
                    <username>regadmin</username> 
                    <password>regadmin</password> 
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                    <maxActive>50</maxActive> 
                    <maxWait>60000</maxWait> 
                    <testOnBorrow>true</testOnBorrow> 
                    <validationQuery>SELECT 1</validationQuery> 
                    <validationInterval>30000</validationInterval> 
                </configuration> 
            </definition> 
        </datasource> 
        <datasource> 
           <name>WSO2_USER_DB</name> 
           <description>The datasource used for registry and user manager</description> 
           <jndiConfig> 
               <name>jdbc/WSO2UMDB</name> 
           </jndiConfig> 
           <definition type="RDBMS"> 
               <configuration> 
                   <url>jdbc:mysql://carbondb.mysql-wso2.com:3306/WSO2_USER_DB</url> 
                   <username>regadmin</username> 
                   <password>regadmin</password> 
                   <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                   <maxActive>50</maxActive> 
                   <maxWait>60000</maxWait> 
                   <testOnBorrow>true</testOnBorrow> 
                   <validationQuery>SELECT 1</validationQuery> 
                   <validationInterval>30000</validationInterval> 
               </configuration> 
           </definition> 
        </datasource> 
   </datasources> 
</datasources-configuration>

If you want to do this change, do it and make sure you delete wso2is-5.0.0/repository/database directory and restart the server with -Dsetup parameter (sh wso2server.sh -Dsetup).

[1] https://docs.wso2.com/display/CLUSTER420/Clustering+API+Manager