[英]Spring Boot app on localhost: connection refused
I have a Spring Boot app which runs fine 80% of the time.我有一个 Spring 启动应用程序,它在 80% 的时间内运行良好。
In the other 20% however, I get "refused to connect" errors on localhost.然而,在另外 20% 中,我在 localhost 上收到“拒绝连接”错误。 What I have tried:我试过的:
Nothing works.没有任何效果。 Then after a while when I keep the app running, it suddenly starts working again.然后在我保持应用程序运行一段时间后,它突然又开始工作了。
As you might know this is really bad for my workflow.您可能知道这对我的工作流程非常不利。 I only have had this problem with Spring Boot apps.我只有 Spring 引导应用程序有这个问题。
But if I check the logs, when trying to connect nothing gets logged: these connection attempts don't even reach my app.但是,如果我检查日志,则在尝试连接时不会记录任何内容:这些连接尝试甚至不会到达我的应用程序。 I'm running on an embedded server under Windows 10.我在 Windows 10 下的嵌入式服务器上运行。
It might be the server blocks incoming connections, and if so, why?可能是服务器阻止了传入连接,如果是这样,为什么?
Everything here runs on localhost.这里的一切都在 localhost 上运行。 Basically trying to open my spring boot app in chrome.基本上是试图在 chrome 中打开我的 spring 启动应用程序。 Yet neither chrome nor anything on the local network can reach my spring boot app.然而,chrome 和本地网络上的任何东西都无法访问我的 spring 启动应用程序。
Any ideas where to proceed with this?有什么想法可以继续进行吗?
I have figured this one out, so turns out, if you're using Quartz for task scheduling, Quartz WILL block your incoming requests in some way until it handles all the triggers it was supposed to fire while the server was off.我已经弄清楚了这一点,所以事实证明,如果您使用 Quartz 进行任务调度,Quartz 会以某种方式阻止您的传入请求,直到它处理所有应该在服务器关闭时触发的触发器。 So the longer you waited between runs the longer you have to wait while Quartz fixes itself.因此,您在运行之间等待的时间越长,您在 Quartz 自行修复时等待的时间就越长。 The solution for local work is simply to turn Quartz off unless you're debugging Quartz itself.本地工作的解决方案是简单地关闭 Quartz,除非您正在调试 Quartz 本身。
Super weird, took me months to understand it.超级奇怪,我花了几个月的时间才理解它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.