我的应用程序可以在linux操作系统中通过终端作为shell可执行文件启动。我在正常执行它时没有问题,但是当我使用'nohup‘命令执行它时,它在'nohup.out’文件中记录了下面的异常
`Exception in thread "Spring Shell" java.lang.IllegalStateException: Shell line reading failure
at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:541)
at org.springframework.shell.core.JLineShell.run(JLineShell.java:179)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Ungültiger Dateideskriptor this is in english “Invalid File Descriptor”
at java.io.FileInputStream.read(Native Method)
at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:169)
at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:137)
at jline.internal.NonBlockingInputStream.read(NonBlockingInputStream.java:246)
at jline.internal.InputStreamReader.read(InputStreamReader.java:261)
at jline.internal.InputStreamReader.read(InputStreamReader.java:198)
at jline.console.ConsoleReader.readCharacter(ConsoleReader.java:2038)
at jline.console.ConsoleReader.readLine(ConsoleReader.java:2242)
at jline.console.ConsoleReader.readLine(ConsoleReader.java:2162)
at jline.console.ConsoleReader.readLine(ConsoleReader.java:2150)
at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:522)
... 2 more
`现在,根据我的分析,我的应用程序是基于spring shell的,它最初在执行应用程序时尝试打开/访问终端/控制台。但是由于使用了nohup,标准输入被从/dev/null重定向,因此我的应用程序试图以终端的身份打开/access /dev/null,因此我得到了上面的异常。
有没有人能告诉我我走的方向对不对?另外,nohup命令还有其他选择吗?
发布于 2016-12-21 00:21:41
您可以尝试如下所示:
nohup java -jar shell-app.jar 'spring shell command' > log.log 2>&1https://stackoverflow.com/questions/37857815
复制相似问题