java - Jetty 9.4 在启动时启动两个 jvm

标签 java jetty jetty-9

建议使用jetty.base Managing 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 像下面的结构

/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启动两个jvm,而如果我直接从jetty运行java -jar start.jar .home 它启动一个 jvm。

有什么具体原因吗?

以下是/mybase/start.ini的配置

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

enter image description here 它还需要比分配的 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 技巧。

您的--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

关于java - Jetty 9.4 在启动时启动两个 jvm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43182941/

相关文章:

java - Jetty-9.3.12 独立服务器中的 EXIT_ON_INIT_FAILURE

java - Android工具栏的文字大小和样式

java - Spring boot war 在 Jboss 7.1 上不起作用

Java 正则表达式不匹配任何内容

spring - 嵌入式 Jetty 无法识别 Spring MVC 安全性

java - 用于数据源使用的 Jetty-maven-plugin 配置

java - -Dfile.encoding = UTF-8 在 JAVA_OPTIONS 中做什么

docker - jaas基本认证 docker 运行者

java - Hibernate 中的并发访问

java - 内存不足错误: Direct buffer memory in jetty websocket with 32 Bit