[英]Not able to open selector in solaris for non root user
I have a server application which runs fine in most of the cases but in one solaris machine it not able to open the selector ,for root user it is working fine. 我有一个服务器应用程序,在大多数情况下都可以正常运行,但是在一台solaris机器上,它无法打开选择器,对于root用户而言,它可以正常工作。 for other user it is giving the below exception
对于其他用户,它给出以下异常
java.io.IOException: Permission denied
at sun.nio.ch.DevPollArrayWrapper.init(Native Method)
at sun.nio.ch.DevPollArrayWrapper.<init>(DevPollArrayWrapper.java:74)
at sun.nio.ch.DevPollSelectorImpl.<init>(DevPollSelectorImpl.java:54)
at sun.nio.ch.DevPollSelectorProvider.openSelector(DevPollSelectorProvider.java:18)
at java.nio.channels.Selector.open(Selector.java:209)
any suggestions on this. 任何建议。
In the absence of a more comprehensive error message from the native wrapper, use truss
to identify the low-level system call which fails (most probably with EACCES
), while running as the non- root
user: 如果没有来自本机包装程序的更全面的错误消息,请以非
root
用户身份运行时,使用truss
识别失败的低级系统调用(很可能是EACCES
):
truss -l -d -f -vall -wall -o truss.out java ... TestOrAppClass
What you expect to see in truss.out
after the Java application throws the exception and terminates (or is terminated) -- note the interleaved spaces in IOE xception
: 在Java应用程序引发异常并终止(或终止)后,您希望在
truss.out
看到什么-请注意IOE xception
的交错空间:
...
...
...
...
23515/1: 0.2912 some_system_call(params) Err#13 EACCES [ALL]
...
23515/1: 0.2923 write(2, 0x08044F84, 39) = 39
23515/1: j a v a . i o . I O E x c e p t i o n : P e r m i s s i o n
23515/1: d e n i e d
...
...
...
...
If the application in question is too complex and generates too much output (or is otherwise difficult to invoke from the command line), then write and compile a small test class which reproduces the problem by calling java.nio.channels.Selector.open()
directly. 如果所涉及的应用程序太复杂且生成了太多输出(或者否则很难从命令行调用),则编写并编译一个小的测试类,该类通过调用
java.nio.channels.Selector.open()
直接。
If you do not/cannot write a simple test class then remember that you can always use the extra output logged by the -wall
option to correlate the time (and thread/LWP) at which the stack trace printout was produced with the actual system call, which should have failed shortly before. 如果您不/不能编写简单的测试类,请记住,您始终可以使用
-wall
选项记录的额外输出来将生成堆栈跟踪打印输出的时间(和线程/ LWP)与实际系统调用相关联,不久前应该会失败。
In the sample truss.out
output above, 23515
is the process ID, /1
is the LWP ID (doubling as "thread" identifier if the JVM uses native threads, which it almost certainly does on Solaris), 0.2912
is the timestamp (seconds since java
process/trace startup), and some_system_call
failing with EACCES
is the call of interest. 在上面的示例
truss.out
输出中, 23515
是进程ID, /1
是LWP ID(如果JVM使用本地线程,则将其加倍为“线程”标识符,这在Solaris上几乎可以肯定), 0.2912
是时间戳(秒) (因为java
进程/跟踪启动),并且EACCES
失败的some_system_call
是引起您关注的调用。
What version of the JDK are you using? 您正在使用哪个版本的JDK?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.