Frage

I am using jetty-9.1.1.v20140108 and tried to start jetty service through the command line showing me the following error. for this, using the JRE "1.7.0_02".

 java.io.IOException: Cannot read file: modules\npn\npn-1.7.0_02.mod
    at org.eclipse.jetty.start.Modules.registerModule(Modules.java:405)
    at org.eclipse.jetty.start.Modules.registerAll(Modules.java:395)
    at org.eclipse.jetty.start.Main.processCommandLine(Main.java:561)
    at org.eclipse.jetty.start.Main.main(Main.java:102)
War es hilfreich?

Lösung

Jetty is looking for a .mod file corresponding to the version of the JRE you are using, but it isn't included in your distribution of Jetty.

In your Jetty/modules/npn directory, make a copy of "npn-1.7.0_04.mod" and name it "npn-1.7.0_02.mod".

Open the file in a text editor and replace all occurrences of "1.1.0.v20120525" with "1.0.0.v20120402".

See http://www.eclipse.org/jetty/documentation/current/npn-chapter.html#npn-versions for more information.

Andere Tipps

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 Jetty Web Server unable to start "java.io.IOException: cannot read file:..")

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top