unable to start jetty service through command in window 7

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 07:19:29

问题


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)

回答1:


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.




回答2:


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:..")



来源:https://stackoverflow.com/questions/21364409/unable-to-start-jetty-service-through-command-in-window-7

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