在Citrix机器中运行时,Spring boot的端口随机监听?

我有一台Citrix机器,我必须在那里运行一个网络服务(使用Spring Boot开发)。它是一台Windows 10主机。有一个奇怪的行为–端口是随机选择的,而不是配置的8090端口。

我检查了我的application.properties,它明确显示

server.port=8090

代码没有问题,如果我从任何其他机器上运行它,它将按预期在8090端口启动。

它甚至在Citrix机器上打印出Tomcat服务器是用8090端口初始化的。但最后它在一个随机的端口(22345)启动,如下面的日志所见。如果我停止并再次启动,它将在另一个端口启动(可能是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)

我甚至尝试在命令行中覆盖它。

java -jar MyApp.jar --server.port=8090

结果还是一样(好像有人奇怪地覆盖了server.port=0,在一个随机端口启动)。

我想重申的是,在我的本地机器上,一切都像预期的那样正常。只有在Citrix机器上存在这种奇怪的行为。

有什么线索可以说明为什么会发生这种情况?谢谢你的时间。


StackOverflow:Spring boot port opens randomly when running in Citrix machine - Stack Overflow