-1

I am trying to build a batch service in an existing application that has server.port=8080 property configured in application.properties file. When I run the batch process and Spring Batch trying to bring up remote partitions(separate JVMs), spring cloud deployer local throws error saying "\r\n\r\n***************************\r\nAPPLICATION FAILED TO START\r\n***************************\r\n\r\nDescription:\r\n\r\nThe Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.\r\n\r\nAction:\r\n\r\nVerify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

Is there a way to make the framework generate random ports for worker partitions being the server.port property that is already configured in the application.properties as is?

Thanks.

Kranthi
  • 37
  • 6
  • A Spring Batch remote partitioning setup requires a message broker for the communication between the manager and workers, but it does not requires any web capabilities. You seem to be deploying all your apps **locally** (manager and workers) as web applications, hence the port conflicts when multiple workers are deployed. Can you confirm that? – Mahmoud Ben Hassine Jan 19 '21 at 08:03
  • @MahmoudBenHassine, yes you are correct. I am trying to deploy my complete application for workers as well. What would be the alternative for it? Can you please suggest? – Kranthi Jan 27 '21 at 04:06

1 Answers1

1

A Spring Batch remote partitioning setup requires a message broker for the communication between the manager and workers, but it does not require any web capabilities. You seem to be deploying all your apps locally (manager and workers) as web applications, hence the port conflict when multiple workers are deployed.

You have at least two options:

  • Either set a random server port for each app (See how Spring Boot allows you to do that here)
  • Or, if the number of workers is fixed, set ports to distinct values statically.
Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50