Pavel Mitrofanov
Pavel Mitrofanov

Reputation: 303

Jetty can't find web application file

I've installed jetty using PKGBUILD from AUR. The configuration was left default.

Note: since makepkg was unable to download jetty v.9.3.2 from offical site, I downloaded it from maven repository

The problem is that when I try to deploy my web application using Jetty Deployable Descriptor XML File, jetty fails to find the war with the following exception:

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)

Here is the contents of the 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>

It should be mentioned that:

  1. When I manually put the war into the webapps directory instead of using xml, everything goes fine.
  2. All users have rwx access to the war: -rwxrwxrwx 1 pmitrofanov pmitrofanov 25104375 Jan 27 16:37 /home/pmitrofanov/sample.war

Upvotes: 0

Views: 2303

Answers (2)

Pavel Mitrofanov
Pavel Mitrofanov

Reputation: 303

The problem is that nobody except the owner has read+execute access to /home/pmitrofanov directory.

Upvotes: 1

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49472

A few things to point out...

  • The Jetty XML format and syntax has changed for Jetty 9.3 it has a new DTD (Highly encouraged you use it)
  • Jetty 8 is EOL (End of Life)
  • As of Servlet 3.x, if you are doing file uploads via POST, its better to use @MultipartConfig or <multipart-config> to define locations, sizes, limits, etc. (not the WebAppContext settings)
  • As of Jetty 9, if you are working with large request headers (hinted at by your 5,000,000 byte max form content setting) you'll probably need to be aware of the Connector's HttpConfiguration which limits the request header sizes more severely then your WebAppContext settings.
  • In your example, the ${jetty.base}/webapps/sample.xml on startup it will immediately look for the war file, if it cannot find it it will not deploy. (you are using a ${jetty.base} with Jetty 9, right? you shouldn't be modifying/adding/deleting files in the jetty distribution, ever)
  • Merely replacing the war will NOT redeploy the war file. You'll have to touch the ${jetty.base}/webappps/sample.xml to trigger a redeploy.
  • There is no provision for monitoring resources referenced in the XML, only the content in ${jetty.base}/webapps/

Upvotes: 1

Related Questions