Невозможно подключить WSO2 API Manager к MariaDB - PullRequest
0 голосов
/ 21 апреля 2020

Я попытался изменить хранилище данных WSO2 APIM по умолчанию с H2 на MariaDB.

Я следовал инструкциям по адресу: https://apim.docs.wso2.com/en/latest/install-and-setup/setting-up-databases/changing-default-databases/changing-to-mysql/

Я установил MariaDB в своей системе :

Server version: 10.4.12-MariaDB-1:10.4.12+maria~bionic mariadb.org binary distribution

Я создал 2 базы данных:

mysql> create database WSO2_MARIA_DB;
mysql> create database APIM_DB;

Я создал таблицы в 2 базах данных:

$ mysql -u root -p -DWSO2_MARIA_DB < '<WSO2_HOME>/dbscripts/mysql.sql';
$ mysql -u root -p -DAPIM_DB < '<WSO2_HOME>/dbscripts/apimgt/mysql.sql';

Я скопировал mysql -connector- java -5.1.48.jar и mariadb- java -client-2.6.0.jar java коннекторы к / repository / components / lib

Я изменил конфигурацию в / repository / conf / deploy.toml to:

[database.apim_db]
type = "mariadb"
url = "jdbc:mariadb://localhost:3306/APIM_DB"
username = "root"
password = "*********"
pool_options.maxActive = 50
pool_options.maxWait = 30000
driver="com.mysql.jdbc.Driver"

[database.shared_db]
type = "mariadb"
url = "jdbc:mariadb://localhost:3306/WSO2_MARIA_DB"
username = "root"
password = "*********"
pool_options.maxActive = 100
pool_options.maxWait = 10000
pool_options.validationInterval = 10000
driver="com.mysql.jdbc.Driver"

Когда я запускаю wso2server, я получаю следующую ошибку:

ERROR - DatabaseUtil Database Error - Unable to load class: com.mysql.jdbc.Driver from ClassLoader:org.eclipse.osgi.internal.loader.EquinoxClassLoader@5d32515d[jdbc-pool:9.0.16.wso2v1(id=90)];

Caused by: org.wso2.carbon.user.core.UserStoreException: Database Error - Unable to load class: com.mysql.jdbc.Driver from ClassLoader:org.eclipse.osgi.internal.loader.EquinoxClassLoader@5d32515d[jdbc-pool:9.0.16.wso2v1(id=90)];ClassLoader:org.eclipse.osgi.internal.framework.ContextFinder@6cb7db61
        at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:172) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:444) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:126) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:276) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        ... 22 more
Caused by: java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:org.eclipse.osgi.internal.loader.EquinoxClassLoader@5d32515d[jdbc-pool:9.0.16.wso2v1(id=90)];ClassLoader:org.eclipse.osgi.internal.framework.ContextFinder@6cb7db61
        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:292) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:162) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:444) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:126) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:276) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        ... 22 more
Caused by: java.lang.ClassNotFoundException: Unable to load class: com.mysql.jdbc.Driver from ClassLoader:org.eclipse.osgi.internal.loader.EquinoxClassLoader@5d32515d[jdbc-pool:9.0.16.wso2v1(id=90)];ClassLoader:org.eclipse.osgi.internal.framework.ContextFinder@6cb7db61
        at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:56) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:281) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:162) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:444) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:126) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:276) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        ... 22 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_211]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_211]
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[?:1.8.0_211]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_211]
        at org.eclipse.osgi.internal.framework.ContextFinder.loadClass(ContextFinder.java:139) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_211]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_211]
        at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_211]
        at org.apache.tomcat.jdbc.pool.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:38) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:281) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:739) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:671) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:198) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[jdbc-pool_9.0.16.wso2v1.jar:?]
        at org.wso2.carbon.user.core.claim.dao.ClaimDAO.getDialectCount(ClaimDAO.java:162) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.populateProfileAndClaimMaps(DefaultRealm.java:444) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealm.init(DefaultRealm.java:126) ~[org.wso2.carbon.user.core_4.5.1.jar:?]
        at org.wso2.carbon.user.core.common.DefaultRealmService.initializeRealm(DefaultRealmService.java:276) ~[org.wso2.carbon.user.core_4.5.1.jar:?]

Дополнительный журнал ошибок:

 Cannot create bundle from jar file /usr/lib/wso2/wso2am/3.0.0/repository/components/lib/mysql-connector-java-5.1.48.jar
    java.io.IOException: Fail to create the directory: /usr/lib/wso2/wso2am/3.0.0/tmp/jarsToBundles/15874636189820.989834824946039
            at org.wso2.carbon.server.util.Utils.createBundle(Utils.java:374)
            at org.wso2.carbon.server.util.Utils.createBundle(Utils.java:356)
            at org.wso2.carbon.server.extensions.DefaultBundleCreator.perform(DefaultBundleCreator.java:68)
            at org.wso2.carbon.server.Main.invokeExtensions(Main.java:152)
            at org.wso2.carbon.server.Main.main(Main.java:104)
            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.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:70)


  SEVERE {org.wso2.carbon.server.extensions.DropinsBundleDeployer updateBundlesInfoFile} - Failed to create the directory: /usr/lib/wso2/wso2am/3.0.0/tmp/bundles_info_79a7e603-ed4a-49cc-be84-d9058b0cd29b/bundles.info 
    java.io.IOException: Failed to create the directory: /usr/lib/wso2/wso2am/3.0.0/tmp/bundles_info_79a7e603-ed4a-49cc-be84-d9058b0cd29b/bundles.info
            at org.wso2.carbon.server.extensions.DropinsBundleDeployer.updateBundlesInfoFile(DropinsBundleDeployer.java:353)
            at org.wso2.carbon.server.extensions.DropinsBundleDeployer.perform(DropinsBundleDeployer.java:114)
            at org.wso2.carbon.server.Main.invokeExtensions(Main.java:157)
            at org.wso2.carbon.server.Main.main(Main.java:104)
            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.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:70)
            at org.wso2.carbon.bootstrap.Bootstrap.main(Bootstrap.java:51)

    [2020-04-21 12:06:59,076]  SEVERE {org.wso2.carbon.server.extensions.DropinsBundleDeployer perform} - Error occured while deploying bundles in the dropins directory 
    java.lang.Exception: Error occurred while updating the bundles.info file.
            at org.wso2.carbon.server.extensions.DropinsBundleDeployer.updateBundlesInfoFile(DropinsBundleDeployer.java:375)
            at org.wso2.carbon.server.extensions.DropinsBundleDeployer.perform(DropinsBundleDeployer.java:114)
            at org.wso2.carbon.server.Main.invokeExtensions(Main.java:157)
            at org.wso2.carbon.server.Main.main(Main.java:104)
            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.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:70)
            at org.wso2.carbon.bootstrap.Bootstrap.main(Bootstrap.java:51)
    Caused by: java.io.IOException: Failed to create the directory: /usr/lib/wso2/wso2am/3.0.0/tmp/bundles_info_79a7e603-ed4a-49cc-be84-d9058b0cd29b/bundles.info
            at org.wso2.carbon.server.extensions.DropinsBundleDeployer.updateBundlesInfoFile(DropinsBundleDeployer.java:353)

Вот мой master-datasources. xml файл из WSO2_HOME / repository / conf / datasources /

<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;MVCC=TRUE
</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>true</defaultAutoCommit>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2_SHARED_DB</name>
<description>Shared Database for user and registry data</description>
<jndiConfig>
<name>jdbc/SHARED_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mariadb://localhost:3306/WSO2_MARIA_DB</url>
<username>root</username>
<password>*********</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<validationQuery/>
<testOnBorrow>true</testOnBorrow>
<maxWait>10000</maxWait>
<defaultAutoCommit>true</defaultAutoCommit>
<validationInterval>10000</validationInterval>
<maxActive>100</maxActive>
</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:mariadb://localhost:3306/APIM_DB</url>
<username>root</username>
<password>*********</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<testOnBorrow>true</testOnBorrow>
<defaultAutoCommit>true</defaultAutoCommit>
<maxActive>50</maxActive>
<maxWait>30000</maxWait>
</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;MVCC=TRUE
</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>
</datasources>
</datasources-configuration>

Что могло пойти не так? Спасибо за вашу помощь!

...