Jetty 9.4 在启动时启动两个 jvm

Jetty 9.4 starts two jvms on startup

建议使用jetty.baseManaging Jetty Base and Jetty Home

Instead of managing multiple Jetty implementations out of several different distribution locations, it is possible to maintain a separation between the binary installation of the standalone Jetty (known as ${jetty.home}), and the customizations for your specific environment(s) (known as ${jetty.base}). There should always only be one Jetty Home (per version of Jetty), but there can be multiple Jetty Base directories that reference it.

我按照下面的结构设置码头

/jetty-9.4.3
 ├──start.jar
 ├── ... 
/mybase
 ├── start.ini
 ├── ... 
 ├── run.bat 

mybase下run.bat有如下脚本

SET JETTY_HOME="../jetty-9.4.3"
echo %JETTY_HOME%
java -jar %JETTY_HOME%/start.jar -Xmx768m -Djetty.base=. -DSTOP.PORT=9999 -DSTOP.KEY=rwos &

当我执行 start.bat 时,jetty 会启动 两个 jvms 而如果我直接从 jetty.home 运行 java -jar start.jar 启动一个jvm.

有什么具体原因吗

以下是/mybase/start.ini

的配置
--module=ext
--module=logging-logback
--module=http
jetty.http.port=8088
--module=resources
--module=deploy

此外,它需要比分配的 768M 更多的内存 4.1GB。需要解决这两个问题。

jetty --list-config 输出保留在这里 https://www.dropbox.com/s/sfwwwhkh0gwdxll/config.txt?dl=0

您的 /mybase/start.ini

中可能有 --exec

这将派生一个 JVM 以传入您指定的 JVM 选项。

如果您在 --list-config 中看到的配置显示 JVM 参数 的条目,那么这些将通过 exec[=31 强制分叉 JVM =] 技术.

您的 --list-config 显示...

Jetty Environment:
-----------------
 jetty.version = 9.4.3.v20170317
 jetty.tag.version = master
 jetty.home = /opt/prod-server/nm_jetty/jetty-9.4.3
 jetty.base = /opt/prod-server/nm_jetty/roy-comp-jetty/.

Config Search Order:
--------------------
 <command-line>
 ${jetty.base} -> /opt/prod-server/nm_jetty/roy-comp-jetty/.
 ${jetty.home} -> /opt/prod-server/nm_jetty/jetty-9.4.3


JVM Arguments:
--------------
 -Dorg.eclipse.jetty.util.log.class?=org.eclipse.jetty.util.log.Slf4jLog

System Properties:
------------------
 STOP.KEY = stop-roy-comp
 STOP.PORT = 15041
 conf.dir = .
 jetty.base = .

Properties:
-----------
 STOP.KEY = stop-roy-comp
 STOP.PORT = 15041
 conf.dir = .
 java.version = 1.8.0_65
 java.version.major = 1
 java.version.micro = 0
 java.version.minor = 8
 java.version.platform = 8
 java.version.update = 65
 jetty.base = /opt/prod-server/nm_jetty/roy-comp-jetty/.
 jetty.http.port = 15040
 jetty.webapp.addServerClasses = ${jetty.base.uri}/lib/slf4j/,${jetty.base.uri}/lib/logback/
 logback.version = 1.1.7
 slf4j.version = 1.7.21

如果 we look at the logging-logback module you have enabled 我们会看到...

[exec]
-Dorg.eclipse.jetty.util.log.class?=org.eclipse.jetty.util.log.Slf4jLog