首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用nohup导致"Bad File Descriptor“异常

使用nohup导致"Bad File Descriptor“异常
EN

Stack Overflow用户
提问于 2016-06-16 19:26:40
回答 1查看 1.7K关注 0票数 4

我的应用程序可以在linux操作系统中通过终端作为shell可执行文件启动。我在正常执行它时没有问题,但是当我使用'nohup‘命令执行它时,它在'nohup.out’文件中记录了下面的异常

代码语言:javascript
复制
`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命令还有其他选择吗?

EN

回答 1

Stack Overflow用户

发布于 2016-12-21 00:21:41

您可以尝试如下所示:

代码语言:javascript
复制
nohup java -jar shell-app.jar 'spring shell command' > log.log 2>&1
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37857815

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档