Jetty Web服务器无法启动"java.io.IOException:无法读取文件:." [英] Jetty Web Server unable to start "java.io.IOException: cannot read file:.."
问题描述
015-04-08 12:56:30 Commons Daemon procrun stderr initialized
java.io.IOException: Cannot read file: C:\Streem\web\modules\annotations.mod
at org.eclipse.jetty.start.Modules.registerModule(Modules.java:549)
at org.eclipse.jetty.start.Modules.registerAll(Modules.java:486)
at org.eclipse.jetty.start.Main.processCommandLine(Main.java:608)
at org.eclipse.jetty.start.Main.main(Main.java:111)
我检查了web \ modules \ protonego-impl \下是否存在已安装的Java版本1.7.0_25和npn-1.7.0_25.mod
I checked that installed Java version 1.7.0_25 and npn-1.7.0_25.mod do exist under web\modules\protonego-impl\
我正在Windows 2008 R2服务器上使用jetty-9.2.5.v20141112
I am using jetty-9.2.5.v20141112 on windows 2008 R2 server
annotations.mod 在这种情况下是否需要特殊的东西?
Does annotations.mod need something special regarding this case?
推荐答案
我们在Windows Server 2008上发现了相同的问题.当Jetty尝试读取模块配置文件时,发生了这种情况,这是由于检查可读性而导致的
We found the same problem on Windows Server 2008. It happens when Jetty is trying to read the module configuration files and is due to a fault in the check for readability.
在码头源文件FS.java第39行中,使用java.nio进行了检查,以查看该文件是否可读:
In the jetty source file FS.java line 39 a check is made using java.nio, to see if the file is readable:
public static boolean canReadFile(Path path)
{
return Files.exists(path) && Files.isRegularFile(path) && Files.isReadable(path);
}
对isReadable的调用缓慢且失败,另请参见: http://mail.openjdk.java.net/pipermail/nio-discuss/2012-July/000672.html
The call to isReadable is slow and fails, see also: http://mail.openjdk.java.net/pipermail/nio-discuss/2012-July/000672.html
文件本身实际上是可读的,可以从Java成功读取,但是isReadable错误地返回false.
The file itself is in fact readable and can be successfully read from Java, but the isReadable incorrectly returns false.
有两种可能的解决方法:
There are two possible workarounds:
- 升级到Java 8
- 从Jetty来源中删除对isReadable的检查(在任何情况下,如果文件不可读,读取都会失败,但会出现异常).
(另请参见类似的问题无法启动码头通过窗口7中的命令进行服务)
(See also similar question unable to start jetty service through command in window 7)
这篇关于Jetty Web服务器无法启动"java.io.IOException:无法读取文件:."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!