Kohei Nozaki's blog 

Using multiple instances of WildFly on shared home directory

Posted on Saturday Jan 24, 2015 at 10:34AM in Technology

Sometimes I need to use multiple instances of WildFly, but it’s annoying to copy whole WildFly package for every needs. also it consumes many diskspace (it’s over 100MB per instance!). an instance means a configuration (deployed applications, registered JDBC driver, datasource, job repository of batch and so on) in this entry.

I leave this entry as a my note of a way to use multiple instances that sharing the home directory (core modules of WildFly) except configuration.

Explode the tarball of WildFly.

tar zxvf ~/Downloads/wildfly-8.2.0.Final.tar.gz

Copy the standalone directory for numbers that you want to use.

cd wildfly-8.2.0.Final
cp -rpv standalone standalone-1
cp -rpv standalone standalone-2

Launch an instance on a specified base directory.

bin/standalone.sh -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone-1

Also -Djboss.socket.binding.port-offset=100 parameter is useful for using multiple instance at same time. it makes WildFly to apply a offset for all of number of ports to listen. for example, following instances can be running at the same time with its own configuration and same core modules:

bin/standalone.sh -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone-1 -Djboss.socket.binding.port-offset=100
bin/standalone.sh -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone-2 -Djboss.socket.binding.port-offset=200

Note that if you use port offset and when you want to use jboss-cli, you need to start jboss-cli with an additional parameter for each instances like following:

./jboss-cli.sh --controller=localhost:10090 --connect

Configuring IntelliJ IDEA.

  1. Open Edit Configurations…​ on the drop down list in upper right corner

  2. Add Local JBoss Server instance

  3. Press Configure…​

  4. Press + button in upper left corner of the window

  5. Enter /Users/kyle/servers/wildfly-8.2.0.Final and press OK twice

  6. Put -Djboss.server.base.dir=/Users/kyle/servers/wildfly-8.2.0.Final/standalone-1 to VM options

  7. Put 100 to Port offset

  8. Press OK

Now you can use same Application server for each Run Configuration. you only need to copy original standalone directory and specify jboss.server.base.dir and Port offset for each projects that needed to manage separately.

Note: the size of standalone directory is around 150K. so reasonable.

kyle-no-MacBook:wildfly-8.2.0.Final kyle$ du -sh standalone
136K	standalone



Hi Kohei,

I know this post is very old, but I'm facing some doubts related to have multiple instances running on Wildfly. With your setup, does it mean that you can have 2 instances of the same deployment running in the same Wildfly installation, with the same root context but listening in different ports?

Heres is a more detailed example:
I have an application called 'foo', so I want to run it listening to different ports (because it's the same app for two different clients). Instead of change all my application to deploy on a different context root, could be possible with your setup to run it this way?

Thanks in advance,


Posted by Ivan on December 07, 2016 at 09:56 PM JST #

Hi Ivan,

I'm not sure if my setup fulfills your requirement but...

With the setup which I described in this posting, you can launch two WildFly instances (which means two JVM) from one installation (which means one "wildfly-8.2.0.Final" directory but two "standalone" copies inside), and you can make these to listen two different ports, but you need to deploy your "foo" app for each instances.

Of course you can deploy those to the same root context because these two WildFly instances are just different servers virtually.

Hope this helps,

Posted by Kohei on December 08, 2016 at 08:14 PM JST #

I know this post is old but I'd like to read your thoughts on that. Is this a valid approach for a production enviroment? I mean, I usually work with one wildfly instance per host for just one app. But because of hardware limitations I have to use the same host for several apps. Do you think your approach is viable for that? Have you ever used on production something like this?

Posted by Viny Machado on June 22, 2018 at 03:37 AM JST #

Hi Viny,

I have never used this on a production environment. I used this approach just for development use on my laptop. Technically it should be fine, but I wouldn’t recommend you to do that in a production environment.

I recommend you to deploy your apps to one WildFly instance.

Posted by Kohei on June 22, 2018 at 09:50 PM JST #

Leave a Comment

HTML Syntax: NOT allowed