I have a Citrix machine and I have to run a web service there (developed using Spring Boot). It is a Windows 10 host. There is a strange behaviour - the port is randomly chosen instead of the configured port 8090.
I checked my application.properties and it is clearly showing
server.port=8090
There is no issue with the code, if I run it from any other machine, it will start in port 8090 as expected.
It even prints out in the Citrix machine that the Tomcat server is initialised with port 8090. But finally it starts at a random port (22345) as seen in the logs below. If I stop and start again, it will start in another port (maybe 23466).
2021-06-28 13:45:52.490 INFO 31792 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8090 (http)
......
......
2021-06-28 13:45:53.348 INFO 31792 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 22345 (http) with context path ''
2021-06-28 13:45:53.355 INFO 31792 --- [ main] com.sreejesh.MainApplicationClass : Started MainApplicationClass in 3.701 seconds (JVM running for 4.798)
I have even tried to override it in command line:
java -jar MyApp.jar --server.port=8090
Still the result is same (as if someone is strangely overwriting server.port=0 to start in a random port).
I want to reiterate that everything works fine in my local machine as expected. Only in Citrix machine this strange behaviour exists.
Any clue as to why this happens? Thank you for your time.