Jetty Web Server unable to start “java.io.IOExcept

2019-07-25 16:50发布

问题:

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?)