Spring boot port opens randomly when running in Citrix machine

108 views Asked by At

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.

1

There are 1 answers

0
Mitch On BEST ANSWER

We had a problem that exactly looked like the problem in your question. After more than one month of research, we finally, found the root cause of our problem and got it fixed. In our case the problem came from a next generation firewall from Palo Alto Networks that was rolled out in our company. After the rollout there was a service on our Citrix based virtual PCs with the name "PAN Terminal Server Agent". When the service was shut down, there were no problems. But for obvious reasons these service should be up and running. So we talked to our IT and they were able to make some configuration changes on the firewall (and/or the PAN Terminal Server Agent, I do not know the details), and now the problem is gone although "PAN Terminal Server Agent" is up and running.