Java приложение, развернутое на Jetty, выдает ошибку HTTP 404 - PullRequest
0 голосов
/ 11 апреля 2020

Я развертываю приложение Java на Jetty. Используйте Gradle для задачи сборки.

Это то, что я получаю при доступе к странице / входа в систему моего приложения:

enter image description here

Использование supervisord с заданием, настроенным следующим образом:

[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

Вот структура каталогов для пути /home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp:

enter image description here

Содержимое ../cp/control-panel.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">/</Set>
    <Set name="war">/home/satvik/workspace/yet_another_msx/mobilestorm/deploy/jetty-context/cp</Set>
    <Set name="maxFormContentSize">100000000</Set>
</Configure>

Содержимое ../cp/start.ini

# ---------------------------------------
# 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

Доступ к http://localhost:8080, дает мне:

enter image description here

Используемые версии:

Java - 13.0.2

Gradle - 1,0-миль3

Причал - 9.4.11.v20180605

Ниже приведен журнал:

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

Еще один вопрос: почему журнал приложений не находится на уровне DEBUG?

Пожалуйста, руководство.

...