简体   繁体   English

Linux上的Java程序关闭

[英]Java program shutdown on Linux

I am running a java server program on Linux in a virtual instance (from provider). 我在Linux上在虚拟实例(来自提供者)中运行java服务器程序。 It is a complex program based on Netty. 这是一个基于Netty的复杂程序。 I start it using: 我开始使用:

nohup java -jar server.jar > server.txt

Then, it works fine. 然后,它工作正常。 But sometimes, it crashes - around 1 time in a week (there is no more process listening on the port). 但有时候,它崩溃了 - 一周大约一次(没有更多的进程监听端口)。 When I read logs, and server.txt , there is nothing in there. 当我读取日志和server.txt ,那里什么都没有。 No exception detected, or log information. 未检测到异常或日志信息。 But the program shuts down. 但程序关闭了。 What can be the reason for such a behaviour? 这种行为可能是什么原因? Any suggestion would be appreciated. 任何建议将不胜感激。

Please run your code like this: 请像这样运行你的代码:

nohup java -jar server.jar >server.txt 2>&1

This will log any errors produced and you can add them here for help or figure out on your own. 这将记录产生的任何错误,您可以在这里添加它们以获得帮助或自行解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM