Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running two spring boot instances

I am using Intellij Idea IDE version 2019.2.3 and I want to run two instances of my spring boot application in different ports, but I got just one running instance. I start the application in the port 8081 and after it runs, I change the port to 8083 and run it again in parallel with the previous one but i got this error :

`The Tomcat connector configured to listen on port 8083 failed to start. The port may already be in use or the connector may be misconfigured.

And when I come to the browser i found that the first port stopped working, when the application runs successfully in the last port`

I have tried to add a new "run configuration" but got the same problem.

enter image description here

like image 302
NFAIHI Avatar asked Oct 11 '19 21:10

NFAIHI


1 Answers

Use the VM options field of the Sprint Boot run/debug configuration to define the port via the

-Dserver.port=9090

property. If the ports are different, you'll be able to start multiple instances:

Running 2 instances on different ports

The screenshot shows 2 run configurations started at the same time, one has -Dserver.port=9090 VM option, another has -Dserver.port=9091.

like image 108
CrazyCoder Avatar answered Sep 28 '22 09:09

CrazyCoder