title: Java application deployed on Jetty gives HTTP ERROR 404
body: <p>I am deploying a Java application to Jetty. Use Gradle for build task. </p>
  
  <p>This is what I get upon accessing the /login page of my application:</p>
  
  <p><a href="https://i.stack.imgur.com/UvGIF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UvGIF.png" alt="enter image description here"></a></p>
  
  <p>Use <a href="http://supervisord.org/" rel="nofollow noreferrer">supervisord</a>, with the task configured as below:</p>
  
  <pre><code>[program:cp-jetty]
  command=/usr/bin/java -DLOG_LEVEL=DEBUG -jar /opt/jetty/start.jar --include-jetty-dir='/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp'
  directory=%(here)s
  redirect_stderr=true
  stdout_logfile = %(here)s/logs/%(program_name)s-stdout.log
  stopwaitsecs=600
  priority=998
  environment = GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005",PREFIX=%(program_name)s
  </code></pre>
  
  <p>Here's the directory structure for path <code>/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/98XvD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/98XvD.png" alt="enter image description here"></a></p>
  
  <p>Contents of <code>../cp/control-panel.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0"  encoding="ISO-8859-1"?&gt;
  &lt;!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"&gt;
  
  &lt;Configure class="org.eclipse.jetty.webapp.WebAppContext"&gt;
      &lt;Set name="contextPath"&gt;/&lt;/Set&gt;
      &lt;Set name="war"&gt;/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp&lt;/Set&gt;
      &lt;Set name="maxFormContentSize"&gt;100000000&lt;/Set&gt;
  &lt;/Configure&gt;
  </code></pre>
  
  <p>Contents of <code>../cp/start.ini</code></p>
  
  <pre><code># ---------------------------------------
  # Module: gzip
  # Enable GzipHandler for dynamic gzip compression
  # for the entire server.
  # ---------------------------------------
  --module=gzip
  
  ## Minimum content length after which gzip is enabled
  # jetty.gzip.minGzipSize=2048
  
  ## Check whether a file with *.gz extension exists
  # jetty.gzip.checkGzExists=false
  
  ## Gzip compression level (-1 for default)
  # jetty.gzip.compressionLevel=-1
  
  ## User agents for which gzip is disabled
  # jetty.gzip.excludedUserAgent=.*MSIE.6\.0.*
  
  ## Inflate request buffer size, or 0 for no request inflation
  # jetty.gzip.inflateBufferSize=0
  
  ## Comma separated list of included methods
  # jetty.gzip.includedMethodList=GET
  
  ## Comma separated list of excluded methods
  # jetty.gzip.excludedMethodList=
  
  # ---------------------------------------
  # Module: server
  # Enables the core Jetty server on the classpath.
  # ---------------------------------------
  --module=server
  
  ### ThreadPool configuration
  ## Minimum number of threads
  # jetty.threadPool.minThreads=10
  
  ## Maximum number of threads
  # jetty.threadPool.maxThreads=200
  
  ## Thread idle timeout (in milliseconds)
  # jetty.threadPool.idleTimeout=60000
  
  ### Common HTTP configuration
  ## Scheme to use to build URIs for secure redirects
  # jetty.httpConfig.secureScheme=https
  
  ## Port to use to build URIs for secure redirects
  # jetty.httpConfig.securePort=8443
  
  ## Response content buffer size (in bytes)
  # jetty.httpConfig.outputBufferSize=32768
  
  ## Max response content write length that is buffered (in bytes)
  # jetty.httpConfig.outputAggregationSize=8192
  
  ## Max request headers size (in bytes)
  # jetty.httpConfig.requestHeaderSize=8192
  
  ## Max response headers size (in bytes)
  # jetty.httpConfig.responseHeaderSize=8192
  
  ## Whether to send the Server: header
  # jetty.httpConfig.sendServerVersion=true
  
  ## Whether to send the Date: header
  # jetty.httpConfig.sendDateHeader=false
  
  ## Max per-connection header cache size (in nodes)
  # jetty.httpConfig.headerCacheSize=512
  
  ## Whether, for requests with content, delay dispatch until some content has arrived
  # jetty.httpConfig.delayDispatchUntilContent=true
  
  ## Maximum number of error dispatches to prevent looping
  # jetty.httpConfig.maxErrorDispatches=10
  
  ## Maximum time to block in total for a blocking IO operation (default -1 is to use idleTimeout on progress)
  # jetty.httpConfig.blockingTimeout=-1
  
  ## Cookie compliance mode of: RFC2965, RFC6265
  # jetty.httpConfig.cookieCompliance=RFC6265
  
  ### Server configuration
  ## Whether ctrl+c on the console gracefully stops the Jetty server
  # jetty.server.stopAtShutdown=true
  
  ## Timeout in ms to apply when stopping the server gracefully
  # jetty.server.stopTimeout=5000
  
  ## Dump the state of the Jetty server, components, and webapps after startup
  # jetty.server.dumpAfterStart=false
  
  ## Dump the state of the Jetty server, components, and webapps before shutdown
  # jetty.server.dumpBeforeStop=false
  
  ## The name to uniquely identify this server instance
  #jetty.defaultSessionIdManager.workerName=node1
  
  ## How frequently sessions are inspected
  #jetty.sessionInspectionInterval.seconds=60
  
  
  # ---------------------------------------
  # Module: http
  # Enables a HTTP connector on the server.
  # By default HTTP/1 is support, but HTTP2C can
  # be added to the connector with the http2c module.
  # ---------------------------------------
  --module=http
  
  ### HTTP Connector Configuration
  
  ## Connector host/address to bind to
  # jetty.http.host=0.0.0.0
  
  ## Connector port to listen on
  # jetty.http.port=8080
  
  ## Connector idle timeout in milliseconds
  # jetty.http.idleTimeout=30000
  
  ## Connector socket linger time in seconds (-1 to disable)
  # jetty.http.soLingerTime=-1
  
  ## Number of acceptors (-1 picks default based on number of cores)
  # jetty.http.acceptors=-1
  
  ## Number of selectors (-1 picks default based on number of cores)
  # jetty.http.selectors=-1
  
  ## ServerSocketChannel backlog (0 picks platform default)
  # jetty.http.acceptorQueueSize=0
  
  ## Thread priority delta to give to acceptor threads
  # jetty.http.acceptorPriorityDelta=0
  
  ## HTTP Compliance: RFC7230, RFC2616, LEGACY
  # jetty.http.compliance=RFC7230
  
  # ---------------------------------------
  # Module: gzip
  # Enable GzipHandler for dynamic gzip compression
  # for the entire server.
  # ---------------------------------------
  --module=gzip
  
  ## Minimum content length after which gzip is enabled
  # jetty.gzip.minGzipSize=2048
  
  ## Check whether a file with *.gz extension exists
  # jetty.gzip.checkGzExists=false
  
  ## Gzip compression level (-1 for default)
  # jetty.gzip.compressionLevel=-1
  
  ## User agents for which gzip is disabled
  # jetty.gzip.excludedUserAgent=.*MSIE.6\.0.*
  
  ## Inflate request buffer size, or 0 for no request inflation
  # jetty.gzip.inflateBufferSize=0
  
  ## Comma separated list of included methods
  # jetty.gzip.includedMethodList=GET
  
  ## Comma separated list of excluded methods
  # jetty.gzip.excludedMethodList=
  
  # ---------------------------------------
  # Module: server
  # Enables the core Jetty server on the classpath.
  # ---------------------------------------
  --module=server
  
  ### ThreadPool configuration
  ## Minimum number of threads
  # jetty.threadPool.minThreads=10
  
  ## Maximum number of threads
  # jetty.threadPool.maxThreads=200
  
  ## Thread idle timeout (in milliseconds)
  # jetty.threadPool.idleTimeout=60000
  
  ### Common HTTP configuration
  ## Scheme to use to build URIs for secure redirects
  # jetty.httpConfig.secureScheme=https
  
  ## Port to use to build URIs for secure redirects
  # jetty.httpConfig.securePort=8443
  
  ## Response content buffer size (in bytes)
  # jetty.httpConfig.outputBufferSize=32768
  
  ## Max response content write length that is buffered (in bytes)
  # jetty.httpConfig.outputAggregationSize=8192
  
  ## Max request headers size (in bytes)
  # jetty.httpConfig.requestHeaderSize=8192
  
  ## Max response headers size (in bytes)
  # jetty.httpConfig.responseHeaderSize=8192
  
  ## Whether to send the Server: header
  # jetty.httpConfig.sendServerVersion=true
  
  ## Whether to send the Date: header
  # jetty.httpConfig.sendDateHeader=false
  
  ## Max per-connection header cache size (in nodes)
  # jetty.httpConfig.headerCacheSize=512
  
  ## Whether, for requests with content, delay dispatch until some content has arrived
  # jetty.httpConfig.delayDispatchUntilContent=true
  
  ## Maximum number of error dispatches to prevent looping
  # jetty.httpConfig.maxErrorDispatches=10
  
  ## Maximum time to block in total for a blocking IO operation (default -1 is to use idleTimeout on progress)
  # jetty.httpConfig.blockingTimeout=-1
  
  ## Cookie compliance mode of: RFC2965, RFC6265
  # jetty.httpConfig.cookieCompliance=RFC6265
  
  ### Server configuration
  ## Whether ctrl+c on the console gracefully stops the Jetty server
  # jetty.server.stopAtShutdown=true
  
  ## Timeout in ms to apply when stopping the server gracefully
  # jetty.server.stopTimeout=5000
  
  ## Dump the state of the Jetty server, components, and webapps after startup
  # jetty.server.dumpAfterStart=false
  
  ## Dump the state of the Jetty server, components, and webapps before shutdown
  # jetty.server.dumpBeforeStop=false
  
  ## The name to uniquely identify this server instance
  #jetty.defaultSessionIdManager.workerName=node1
  
  ## How frequently sessions are inspected
  #jetty.sessionInspectionInterval.seconds=60
  
  
  # ---------------------------------------
  # Module: http
  # Enables a HTTP connector on the server.
  # By default HTTP/1 is support, but HTTP2C can
  # be added to the connector with the http2c module.
  # ---------------------------------------
  --module=http
  
  ### HTTP Connector Configuration
  
  ## Connector host/address to bind to
  # jetty.http.host=0.0.0.0
  
  ## Connector port to listen on
  jetty.http.port=8080
  
  ## Connector idle timeout in milliseconds
  # jetty.http.idleTimeout=30000
  
  ## Connector socket linger time in seconds (-1 to disable)
  # jetty.http.soLingerTime=-1
  
  ## Number of acceptors (-1 picks default based on number of cores)
  # jetty.http.acceptors=-1
  
  ## Number of selectors (-1 picks default based on number of cores)
  # jetty.http.selectors=-1
  
  ## ServerSocketChannel backlog (0 picks platform default)
  # jetty.http.acceptorQueueSize=0
  
  ## Thread priority delta to give to acceptor threads
  # jetty.http.acceptorPriorityDelta=0
  
  ## HTTP Compliance: RFC7230, RFC2616, LEGACY
  # jetty.http.compliance=RFC7230
  
  # ---------------------------------------
  # Module: deploy
  # Enables webapplication deployment from the webapps directory.
  # ---------------------------------------
  --module=deploy
  
  # Monitored directory name (relative to $jetty.base)
  # jetty.deploy.monitoredDir=webapps
  # - OR -
  # Monitored directory path (fully qualified)
  jetty.deploy.monitoredPath=/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp
  
  # Defaults Descriptor for all deployed webapps
  # jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault.xml
  
  # Monitored directory scan period (seconds)
  # jetty.deploy.scanInterval=1
  
  # Whether to extract *.war files
  # jetty.deploy.extractWars=true
  
  # ---------------------------------------
  # Module: sessions
  # The session management. By enabling this module, it allows
  # session management to be configured via the ini templates
  # created or by enabling other session-cache or session-store
  # modules.  Without this module enabled, the server may still
  # use sessions, but their management cannot be configured.
  # ---------------------------------------
  --module=sessions
  
  ## The name to uniquely identify this server instance
  #jetty.sessionIdManager.workerName=node1
  
  ## Period between runs of the session scavenger (in seconds)
  #jetty.sessionScavengeInterval.seconds=600
  
  # ---------------------------------------
  # Module: jsp
  # Enables JSP for all webapplications deployed on the server.
  # ---------------------------------------
  --module=jsp
  
  </code></pre>
  
  <p>Accessing <code>http://localhost:8080</code>, gives me:</p>
  
  <p><a href="https://i.stack.imgur.com/27A0j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/27A0j.png" alt="enter image description here"></a></p>
  
  <p>Versions used:</p>
  
  <p>Java - 13.0.2</p>
  
  <p>Gradle - 1.0-milestone3</p>
  
  <p>Jetty - 9.4.11.v20180605</p>
  
  <p>Below is the log:</p>
  
  <pre><code>2020-04-11 20:55:41.667:INFO::main: Logging initialized @771ms to org.eclipse.jetty.util.log.StdErrLog
  2020-04-11 20:55:42.145:INFO:oejs.Server:main: jetty-9.4.11.v20180605; built: 2018-06-05T18:24:03.829Z; git: d5fc0523cfa96bfebfbda19606cad384d772f04c; jvm 13.0.2+8
  2020-04-11 20:55:42.169:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp/] at interval 1
  2020-04-11 20:55:42.401:WARN:oeja.AnnotationParser:main: Unknown asm implementation version, assuming version 393216
  2020-04-11 20:55:42.507:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=104ms
  2020-04-11 20:55:42.666:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@7d8995e{/,file:///home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp/,AVAILABLE}{/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp}
  2020-04-11 20:55:42.668:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
  2020-04-11 20:55:42.669:INFO:oejs.session:main: node0 Scavenging every 600000ms
  2020-04-11 20:55:42.726:INFO:oejs.AbstractConnector:main: Started ServerConnector@25ce9dc4{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
  2020-04-11 20:55:42.729:INFO:oejs.Server:main: Started @1833ms
  
  </code></pre>
  
  <p>Another query: Why isn't the application logging at DEBUG level?</p>
  
  <p>Please guide.</p>