Right way to export\\transfer WildFly 9 server options to other PC

僤鯓⒐⒋嵵緔 提交于 2019-12-04 13:40:48

I would strongly encourage you to use the jboss-cli to run this instead. Copying the files will work but I would argue that it's better to have a repeatable process.

To add a datasource, you'd run the following. Since you're using WildFly 9, it can be a bit simpler. Put the following commands in a file - for example, db_setup.txt. Then run $WILDFLY_HOME/bin/jboss-cli.sh --file=db_setup.txt. The file will contain something like the following:

embed-server --std-out=echo --server-config=standalone.xml

batch

module add --name=com.mysql.driver --resources=/path/to/mysql-connector-java-5.1.33.jar --dependencies=javax.api,javax.transaction.api
/subsystem=datasources/jdbc-driver=mysql:add(driver-name="mysql",driver-module-name="com.mysql.driver",driver-class-name=com.mysql.jdbc.Driver)
/subsystem=datasources/data-source=myPool/:add(connection-url=jdbc:mysql://127.0.0.1:3306/dbName,driver-name=mysql,jndi-name=java:/jdbc/dbName,password=password,user-name=user)

WARNING - I have not fully tested these commands so they may require a bit of tweaking. But the concepts are there.

The one issue you'll have is that, during testing, the jboss-cli.sh command will just exit if there is an error. You may want a file to remove these too:

/subsystem=datasources/data-source=myPool/:remove
/subsystem=datasources/jdbc-driver=my:remove
module remove --name=com.mysql.driver
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!