带分析的WSO2 API Manager:stats-datasources.xml' - 系统数据源WSO2AM_STATS_DB无法更新

时间:2017-03-02 19:48:16

标签: wso2 wso2-am

我正在尝试使用wso2am-analytics-2.1.0和wso2am-2.0.0设置统计信息。根据我在分析和wso2am中配置相同WSO2AM_STATS_DB的文档。当我启动分析服务器时,它给我以下错误。我已经验证了所有以前的帖子,但不知何故无法确定此问题的解决方案。

[2017-03-02 11:29:32,323] ERROR {org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent} -  Error in intializing system data sources: Error in initializing system data sources: Error in initializing system data sources at 'C:\MAHABO~1\WSO2AM~2.0\bin\..\repository\conf\datasources\stats-datasources.xml' - System datasource WSO2AM_STATS_DBcan not be updated.
org.wso2.carbon.ndatasource.common.DataSourceException: Error in initializing system data sources: Error in initializing system data sources at 'C:\MAHABO~1\WSO2AM~2.0\bin\..\repository\conf\datasources\stats-datasources.xml' - System datasource WSO2AM_STATS_DBcan not be updated.
        at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSources(DataSourceManager.java:168)
        at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.initSystemDataSources(DataSourceServiceComponent.java:192)
        at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.setSecretCallbackHandlerService(DataSourceServiceComponent.java:178)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:376)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:430)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bind(ServiceComponentProp.java:218)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:343)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
        at org.wso2.carbon.securevault.internal.SecretManagerInitializerComponent.activate(SecretManagerInitializerComponent.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:473)
        at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:217)
        at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:816)
        at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:783)
        at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.carbon.ndatasource.common.DataSourceException: Error in initializing system data sources at 'C:\MAHABO~1\WSO2AM~2.0\bin\..\repository\conf\datasources\stats-datasources.xml' - System datasource WSO2AM_STATS_DBcan not be updated.
        at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSource(DataSourceManager.java:188)
        at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSources(DataSourceManager.java:164)
        ... 40 more
Caused by: org.wso2.carbon.ndatasource.common.DataSourceException: System datasource WSO2AM_STATS_DBcan not be updated.
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.registerDataSource(DataSourceRepository.java:344)
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.addDataSource(DataSourceRepository.java:473)
        at org.wso2.carbon.ndatasource.core.DataSourceManager.initSystemDataSource(DataSourceManager.java:185)
        ... 41 more
[2017-03-02 11:29:34,269]  INFO {org.wso2.carbon.user.core.common.DefaultRealmService} -  Database already exists. Not creating a new database.


Analytics stats-datasources.xml :

<providers>
    <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>

<datasources>


    <datasource>
   <name>WSO2AM_STATS_DB</name>
   <description>The datasource used for setting statistics to API Manager</description>
   <jndiConfig>
      <name>jdbc/WSO2AM_STATS_DB</name>
   </jndiConfig>
   <definition type="RDBMS">
      <configuration>
         <url>jdbc:mysql://localhost:3306/WSO2AM_STATS_DB?autoReconnect=true&amp;relaxAutoCommit=true</url>
         <username>root</username>
         <password>root</password>
         <driverClassName>com.mysql.jdbc.Driver</driverClassName>
         <maxActive>50</maxActive>
         <maxWait>60000</maxWait>
         <testOnBorrow>true</testOnBorrow>
         <validationQuery>SELECT 1</validationQuery>
         <validationInterval>30000</validationInterval>
         <defaultAutoCommit>false</defaultAutoCommit>
      </configuration>
   </definition>
</datasource>

 </datasources>

Analytics master-datasources.xml

<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>
                <defaultAutoCommit>false</defaultAutoCommit>
            </configuration>
        </definition>
    </datasource>

    <!-- sample testing purpose -->
    <datasource>
    <name>WSO2AM_STATS_DB</name>
    <description>The datasource used for setting statistics to API Manager</description>
    <jndiConfig>
    <name>jdbc/WSO2AM_STATS_DB</name>
    </jndiConfig>
    <definition type="RDBMS">
    <configuration>
     <url>jdbc:mysql://localhost:3306/WSO2AM_STATS_DB?autoReconnect=true&amp;relaxAutoCommit=true</url>
     <username>root</username>
     <password>root</password>
     <driverClassName>com.mysql.jdbc.Driver</driverClassName>
     <maxActive>50</maxActive>
     <maxWait>60000</maxWait>
     <testOnBorrow>true</testOnBorrow>
     <validationQuery>SELECT 1</validationQuery>
     <validationInterval>30000</validationInterval>
     <defaultAutoCommit>false</defaultAutoCommit>
    </configuration>
    </definition>
    </datasource>

    <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
    <!--datasource>
        <name>SAMPLE_DATA_SOURCE</name>
        <jndiConfig>
            <name></name>
            <environment>
                <property name="java.naming.factory.initial"></property>
                <property name="java.naming.provider.url"></property>
            </environment>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>

                <defaultAutoCommit></defaultAutoCommit>
                <defaultReadOnly></defaultReadOnly>
                <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
                <defaultCatalog></defaultCatalog>
                <username></username>
                <password svns:secretAlias="WSO2.DB.Password"></password>
                <maxActive></maxActive>
                <maxIdle></maxIdle>
                <initialSize></initialSize>
                <maxWait></maxWait>

                <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
                <dataSourceProps>
                    <property name="url">jdbc:mysql://localhost:3306/Test1</property>
                    <property name="user">root</property>
                    <property name="password">123</property>
                </dataSourceProps>

            </configuration>
        </definition>
    </datasource-->

</datasources>

APIM master-datasoruces.xml

<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</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>WSO2AM_DB</name>
        <description>The datasource used for API Manager database</description>
        <jndiConfig>
            <name>jdbc/WSO2AM_DB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:h2:repository/database/WSO2AM_DB;DB_CLOSE_ON_EXIT=FALSE</url>
                <username>wso2carbon</username>
                <password>wso2carbon</password>
                <defaultAutoCommit>false</defaultAutoCommit>
                <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>WSO2AM_STATS_DB</name>
   <description>The datasource used for setting statistics to API Manager</description>
   <jndiConfig>
      <name>jdbc/WSO2AM_STATS_DB</name>
   </jndiConfig>
   <definition type="RDBMS">
      <configuration>
         <url>jdbc:mysql://localhost:3306/WSO2AM_STATS_DB?autoReconnect=true&amp;relaxAutoCommit=true</url>
         <username>root</username>
         <password>root</password>
         <driverClassName>com.mysql.jdbc.Driver</driverClassName>
         <maxActive>50</maxActive>
         <maxWait>60000</maxWait>
         <testOnBorrow>true</testOnBorrow>
         <validationQuery>SELECT 1</validationQuery>
         <validationInterval>30000</validationInterval>
         <defaultAutoCommit>false</defaultAutoCommit>
      </configuration>
   </definition>
</datasource>

    <datasource>
        <name>WSO2_MB_STORE_DB</name>
        <description>The datasource used for message broker database</description>
        <jndiConfig>
            <name>WSO2MBStoreDB</name>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>
                <url>jdbc:h2:repository/database/WSO2MB_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>
                <defaultAutoCommit>false</defaultAutoCommit>
            </configuration>
        </definition>
    </datasource>

    <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
    <!--datasource>
        <name>SAMPLE_DATA_SOURCE</name>
        <jndiConfig>
            <name></name>
            <properties>
                <property name="java.naming.factory.initial"></property>
                <property name="java.naming.provider.url"></property>
            </properties>
        </jndiConfig>
        <definition type="RDBMS">
            <configuration>

                <defaultAutoCommit></defaultAutoCommit>
                <defaultReadOnly></defaultReadOnly>
                <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
                <defaultCatalog></defaultCatalog>
                <username></username>
                <password svns:secretAlias="WSO2.DB.Password"></password>
                <maxActive></maxActive>
                <maxIdle></maxIdle>
                <initialSize></initialSize>
                <maxWait></maxWait>

                <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
                <dataSourceProps>
                    <property name="url">jdbc:mysql://localhost:3306/Test1</property>
                    <property name="user">root</property>
                    <property name="password">123</property>
                </dataSourceProps>

            </configuration>
        </definition>
    </datasource-->

</datasources>

1 个答案:

答案 0 :(得分:4)

如果您在服务器配置中多次定义了相同的数据源,则可能会发生此错误。如果检查分析服务器配置,则在stats-datasources.xml和master-datasources.xml中定义 WSO2AM_STATS_DB 。您无需在master-datasources.xml中定义它。请删除该数据源并启动分析服务器。