[英]Wildfly: Got permission denied when use RandomAccessFile
当我尝试打开位于主机系统上的命名管道的RandomAccessFile时,出现以下错误
12:54:45,048 SEVERE [com.dev.app.servlet.BackgroundListener] (Thread-514) null: java.io.FileNotFoundException: /home/centos/file (Permission denied)
at java.base/java.io.RandomAccessFile.open0(Native Method)
at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:345)
at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:214)
at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:127)
at deployment.app.war//com.dev.app.util.Reader.run(Reader.java:35)
管道上的os权限如下
prwxrwxrwx. 1 centos centos 0 Jun 2 12:50 file
这是我用来访问文件的代码
RandomAccessFile pipe = null;
BufferedReader br = null;
try {
pipe = new RandomAccessFile(Paths.PIPE, "rw");
} catch (FileNotFoundException ex) {
Logger.getLogger(BackgroundListener.class.getName()).log(Level.SEVERE, null, ex);
}
我的服务器配置:Wildfly 13,Jdk 10,Centos 7
在debian机器上,相同的war文件可以正常工作,这可能是问题的原因吗?
非常感谢。
有解决方案,这是一个权限问题。 / home / centos / file在777上设置了Altought权限,/ home / centos文件夹在700上设置了权限
centos@ip ~ $ getfacl /home/centos
# file: home/centos
# owner: centos
# group: centos
user::rwx
group::---
other::---
通过修复权限解决,谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.