CENTOS7安裝WildFly12.0+mariadb
1.至官網下載WildFly最新版http://wildfly.org/downloads/
2.將檔案解壓縮並將整個目錄放至/usr/local下
cp -R 原目錄位置 /usr/local/
3.啟動jboss wildfly
搜尋datasource
加入以下資訊 ==>將下面IP、PORT及DB1改成自己的
<datasource jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" statistics-enabled="true">
<connection-url>jdbc:mariadb://10.92.142.148:6603/DB1</connection-url>
<driver>mariadb</driver>
<new-connection-sql>SELECT 1</new-connection-sql>
<security>
<user-name>your-database-username</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
vi /usr/local/wildfly-12.0.0/modules/system/layers/base/org/mariadb/main/module.xml
2.將檔案解壓縮並將整個目錄放至/usr/local下
cp -R 原目錄位置 /usr/local/
3.啟動jboss wildfly
/usr/local/wildfly-12.0.0.Final/bin/standalone.sh
4.至本機127.0.0.1位置連接看是否會出現wildfly 畫面
http://127.0.01:9990
如有出現以下畫面表示啟動成功
5.建立mariadb driver目錄並將檔案放到指定位置
mkdir -p /usr/local/wildfly-12.0.0/modules/system/layers/base/org/mariadb/main
將Driver放至剛剛新增的目錄
mv mariadb-java-client-2.2.3.jar /usr/local/wildfly-12.0.0/modules/system/layers/base/org/mariadb/main/
6.新增mariadb driver & 開放IP
vi /usr/local/wildfly-12.0.0/standalone/configuration/standalone.xml
搜尋127.0.0.1(vi使用 / 字串去搜尋)
將
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/> ##將127.0.0.1改為0.0.0.0
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
搜尋driver
加入以下資訊
<driver name="mariadb" module="org.mariadb">
<xa-datasource-class>org.mariadb.jdbc.MariaDbDataSource</xa-datasource-class>
</driver>
加入以下資訊 ==>將下面IP、PORT及DB1改成自己的
<datasource jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" statistics-enabled="true">
<connection-url>jdbc:mariadb://10.92.142.148:6603/DB1</connection-url>
<driver>mariadb</driver>
<new-connection-sql>SELECT 1</new-connection-sql>
<security>
<user-name>your-database-username</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
</validation>
</datasource>
7.新增module.xml
<module xmlns="urn:jboss:module:1.1" name="org.mariadb">
<resources>
<resource-root path="mariadb-java-client-2.2.3.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
path對應上面COPY的資料夾檔案
8.從新啟動看是否成功,如果有ERROR確認一下PATH是否對應正確及資料庫是否設定正確
9.建立管理者帳號
留言
張貼留言