Jetty Web Server unable to start “java.io.IOException: cannot read file:..”

柔情痞子 提交于 2019-12-13 17:30:22

问题


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)

I checked that installed Java version 1.7.0_25 and npn-1.7.0_25.mod do exist under web\modules\protonego-impl\

I am using jetty-9.2.5.v20141112 on windows 2008 R2 server

Does annotations.mod need something special regarding this case?


回答1:


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.

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);
}

The call to isReadable is slow and fails, see also: http://mail.openjdk.java.net/pipermail/nio-discuss/2012-July/000672.html

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:

  1. Upgrade to Java 8
  2. Remove the check for isReadable from the Jetty source (in any case if the file wasn't readable the reading will fail with an exception).

(See also similar question unable to start jetty service through command in window 7)




回答2:


This is a fundamental I/O error, something prevented Jetty from reading that file.

Try some basic troubleshooting ...

  • File permissions?
  • Windows File Locking issue? (a different process has that file open?)


来源:https://stackoverflow.com/questions/29522962/jetty-web-server-unable-to-start-java-io-ioexception-cannot-read-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!