vels4j
vels4j

Reputation: 11298

Jetty 9.4 starts two jvms on startup

It is advised to use 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.

I setup jetty like the following structure

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

under mybase run.bat has the following script

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 &

when I execute start.bat jetty launches two jvms whereas if I directly run java -jar start.jar from jetty.home it launches one jvm.

Is there any specific reason.

The following is the config of /mybase/start.ini

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

enter image description here Also it takes more memory 4.1GB than allotted 768M. Need to resolve these two issues.

jetty --list-config output is kept here https://www.dropbox.com/s/sfwwwhkh0gwdxll/config.txt?dl=0

Upvotes: 1

Views: 1112

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49505

You likely have an --exec line in your /mybase/start.ini

That will fork a JVM to pass in the JVM options you are specifying.

If your configuration seen in --list-config shows entries for JVM Arguments then those are going to force a forked JVM via the exec techniques.

Your --list-config shows ...

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

And if we look at the logging-logback module you have enabled we'll see...

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

Upvotes: 1

Related Questions