Multiple Instances of WildFly on Different Ports on Same Machine (Tech Tip #8)

WildFly can be started on the default port 8080 using:

./bin/standalone.sh

The default landing page is then accessible at localhost:8080 and looks like:

tt1-wildfly-welcome

The default admin console is accessible at localhost:9990/console and looks like:

tt8-admin-console

Do you want to start another WildFly standalone instance on the same machine on a different port ?

./bin/standalone.sh -Djboss.socket.binding.port-offset=1000

will start another standalone server on port 8080 + 1000. And so the landing page is now accessible at localhost:9080. Similarly, admin console is now accessible at localhost:10990/console.

Similarly, you can start multiple instances by specifying port offset.

Be Sociable, Share!
  • Tweet

11 thoughts on “Multiple Instances of WildFly on Different Ports on Same Machine (Tech Tip #8)

  1. Hi Arun,

    Any tutorial on how to setup WilFly JEE clustering, with details like:
    – load balancer
    – how http session and stateful ejbs data is replicated to a backup cluster instance
    – failover
    – scaling
    – integration with in-memory data grids

  2. WildFly 8 docs are available at:

    https://docs.jboss.org/author/display/WFLY8/Documentation

    High Availability Guide (work in progress) is available at:

    https://docs.jboss.org/author/display/WFLY8/High+Availability+Guide

    I’ll blog about it in the next few weeks with detailed steps.

  3. Hi Arun,

    Nice article. I am working on one test app in cluster environment. I have deployed remote stateless ejb on cluster (node A and node B in domain mode). I start one more standalone instance on node A and try to deploy a client app. Issue is that client cannot connect to ejb on node A while it connects to node B without any problems. If I put client on node B also on standalone instance it cannot connect to ejb on node B but can connect to node A.
    Is this expected behavior or I’m missing something? Any link or tutorial will be mostly appreciated. My goal is to have one cluster where I will deploy remote stateless ejb in one server group and client on the same cluster under other server group which will communicate with both nodes. Is this possible? Thanks.

  4. We created an app that runs on wildfly.8.1.0.Final, but I must use two diffrent machines running wildfly for load balancing and fail over, can you help with this? Or do you know where I can look for some info on this?

  5. That’s quite a clever setting. It shifts all the ports, though, including 9990 which is used for mvn deploy. Would be interesting if you could add a list of things that change / that are affected by this shift…

  6. Hi Arun,

    Hope its not too late to comment on this article. Wanted to share a behaviour of wildfly i observed related to this article and also if you can suggest or share your thoughts on this.
    For this multi instance standalone setup was using Wildfly-9.0.1.final. In the same machine started 2 standalone instances running on different ports and also had visualVM running to monitor these process.
    Deployed app1.war through jboss-cli in 1st instance and all was rest services were good and working fine.
    Deployed app2.war through jboss-cli in 2nd instance now when i try accessing the same rest services of app1 there were NoClassDefFoundError which later on was pointing to ClassNotFoundException. The stack trace then had this ModuleLoader.findClass.

    Initially suspected it was problem with the packaging of war file (Maven). But the same war file was working fine in single instance that is by placing the war file in deployments directory of Wildfly.

    So repeated the same steps by monitoring with visualVM for JMX MBean ServiceModuleLoader.

    1. Started instance 1 (command – ./standalone.sh -c standalone_app1.xml) – deployed the app1.war
    2. Took a dump of all the resources that were loaded by ServiceModuleLoader using VisualVM. Along with other resource there were 2 set of VFS Resource which had all the package path of class files from the app1.war.
    3. Verified the Rest service of app1 and was good.
    3. Started instance 2 (command – ./standalone.sh -c standalone_app2.xml) – deployed the app2.war. Now the 1st instance which had this 2 set of VFS resource were gone.
    4. Now upon invoking the same Rest services observed NoClassDefFoundError.

    Is there anything wrong with this setup?

    Thanks!

  7. Hello Arun,

    I used 0100 as the offset value, and now management console of 2nd and 3rd JVM runs on 10090 and 10190 respectively.

    :9990 is working fine, but 10090/10190 are not displaying anything.

    Could you please guide whats wrong here?

    Thanks,
    Saurabh

  8. When starting multiple instances of wildfly by using the port off set, how can different application be deployed to each instance when there is only one deployments directory. I need a.war running on server a and b.war running on server b.

  9. How can I restart a bundle using OSGI 8 admin console. There is bundle Stop and Start button. I stopeed a bundle, then I changed my code, build new jar for that bundle and placed OSGI 8 server. Then started that bundle . New code not reflected. Any help. Plz

Leave a Reply

Your email address will not be published. Required fields are marked *