Jetty无法找到网络应用程序文件

时间:2016-01-27 14:33:54

标签: jetty archlinux jetty-9

我已使用AUR的PKGBUILD安装了码头。配置默认为。

注意:由于makepkg无法从官方网站下载jetty v.9.3.2,我从maven资源库下载了

问题在于,当我尝试使用Jetty Deployable Descriptor XML File部署我的Web应用程序时,jetty无法找到具有以下异常的战争:

2016-01-27 17:05:30.265:WARN:oejw.WebInfConfiguration:main: Web application not found /home/pmitrofanov/sample.war
2016-01-27 17:05:30.265:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@1efbd816{/sample,null,null}{/home/pmitrofanov/sample.war}
java.io.FileNotFoundException: /home/pmitrofanov/sample.war
    at org.eclipse.jetty.webapp.WebInfConfiguration.unpack(WebInfConfiguration.java:495)
    at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:72)
    at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:474)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:510)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
    at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:459)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:561)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
    at org.eclipse.jetty.server.Server.start(Server.java:405)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
    at org.eclipse.jetty.server.Server.doStart(Server.java:372)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1510)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1435)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:214)
    at org.eclipse.jetty.start.Main.start(Main.java:457)
    at org.eclipse.jetty.start.Main.main(Main.java:75)

以下是xml的内容:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/sample</Set>
    <Set name="war">/home/pmitrofanov/sample.war</Set>
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- Max Form Size                                                   -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <Set name="maxFormContentSize">5000000</Set>
</Configure>

应该提到:

  1. 当我手动将战争放入webapps目录而不是使用xml时,一切都很顺利。
  2. 所有用户都拥有rwx访问战争的权限:-rwxrwxrwx 1 pmitrofanov pmitrofanov 25104375 Jan 27 16:37 /home/pmitrofanov/sample.war

2 个答案:

答案 0 :(得分:1)

要指出的一些事情......

  • Jetty 9.3的Jetty XML格式和语法已更改a new DTD(强烈建议您使用它)
  • Jetty 8 is EOL (End of Life)
  • 从Servlet 3.x开始,如果您通过POST进行文件上传,最好使用@MultipartConfig<multipart-config>来定义位置,大小,限制等(不是{{1}设置)
  • 从Jetty 9开始,如果您正在处理大型请求标头(由5,000,000字节的最大格式内容设置提示),您可能需要了解连接器HttpConfiguration这会比WebAppContext设置更严格地限制请求标头大小。
  • 在您的示例中,启动时WebAppContext会立即查找war文件,如果找不到它,则不会部署。 (你正在使用带有Jetty 9的${jetty.base}/webapps/sample.xml,对吗?你不应该在码头发行版中修改/添加/删除文件)
  • 仅仅更换战争不会重新部署战争档案。您必须触摸${jetty.base}才能触发重新部署。
  • 没有规定监控XML中引用的资源,只提供${jetty.base}/webappps/sample.xml
  • 中的内容

答案 1 :(得分:1)

问题是除了所有者之外没有人对/home/pmitrofanov目录有读取+执行权限。