Search code examples
linuxjbosswildfly

How to set JBOSS_BASE_DIR for different WildFly instances?


My Setup

I'm currently running 2 instances of WildFly 9.0.0.CR1 on a Linux machine.

I have install scripts that set everything up. It creates a sim_standalone folder in addition to the existing standalone folder and copies in a sim-standalone-full.xml file (this file offsets the port number by 100).

They are both installed as services under /etc/init.d/wildfly and /etc/init.d/sim-wildfly, with sim-wildfly being tweaked to use a different configuration file (it points to the sim_standalone folder and uses the sim-standalone-full.xml file instead of standalone and standalone-full.xml).


My Question

The only issue I'm having now is that both wildfly and sim-wildfly are using the JBOSS_HOME/bin/standalone.sh file to run. This causes issues because JBOSS_BASE_DIR points to the standalone folder, causing the logs to overlap and the deployments to be read from that folder for both instances.

My current solution is to create another standalone.sh file and change the JBOSS_BASE_DIR to the sim_standalone folder; however, I would like to know if there is a way to set JBOSS_BASE_DIR in one of my existing files without having to create another standalone.sh file. I tried setting it in sim-wildfly.conf since there are many other variables in there, but that didn't work.

Any help would be appreciated!


EDIT: So my /etc/init.d/sim-wildfly script runs standalone.sh. It sets the script by setting:

JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh

I'm trying to set it to:

JBOSS_SCRIPT=$JBOSS_HOME/bin/standalone.sh -Djboss.server.base.dir=$JBOSS_HOME/sim_standalone

...but that doesn't seem to be working. It says that Djboss.server.base.dir=$JBOSS_HOME/sim_standalone is not a file or directory when I run systemctl status sim-wildfly. I tried wrapping it in quotes as well. What am I missing?


Solution

  • Set the jboss.server.base.dir property, e.g. by calling

    standalone.sh -Djboss.server.base.dir=/opt/server1