I'm working with the Jetty standalone Version 9.3.9 (start.jar) and got the following issue:
The Jetty has SSL enabled and can only be accessed via https. The start and stop of the jetty-server is managed by two shellscripts, which defines the stop-port and the stop-key:
java -DSTOP.PORT=PORT -DSTOP.KEY=secret start.jar
PORT and KEY are just placeholders
Via the --stop
parameter the Jetty server stops correctly.
Now when the module http2
is enabled (it works perfectly) and the stop script is executed, i receive the following error (first line is translated).
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:244)
at org.eclipse.jetty.start.Main.stop(Main.java:512)
at org.eclipse.jetty.start.Main.stop(Main.java:491)
at org.eclipse.jetty.start.Main.doStop(Main.java:479)
at org.eclipse.jetty.start.Main.start(Main.java:403)
at org.eclipse.jetty.start.Main.main(Main.java:75)
and the server does not shut down. Inspected with ps aux
there are also now two processes, one of them does contain the following line and is also spawned when http2
is disabled:
java -DSTOP.PORT=PORT -DSTOP.KEY=secret
The other (new) one contains a huge ugly call to java and it looks like it's loading different resources via Xbootclasspath
java -Xbootclasspath/p:lib/alpn/alpn-boot-8.1.7.v20160121.jar
-Djava.io.tmpdir=/tmp -Djetty.home=jettyfolder/jetty-9.3.9
-Djetty.base=jettyfolder/jetty-9.3.9/myappbase
-cp jettyfolder/jetty-9.3.9/lib/apache-jsp/org.eclipse.jdt.core.compiler.
ecj-4.4.2.jar:jettyfolder/jetty-9.3.9/lib/apachejsp/org.eclipse.jetty.apache-jsp-9.3.9.v20160517.jar:jettyfolder/jetty-9.3.9/lib/apache-
... and so on. Probably it belongs to ALPN
which is used by HTTP/2
.
As soon as http2 is disabled (for example when the folder start.d is renamed), the studown via port and key work's again.
Edit2, added output of start.jar --list-config:
Java Environment:
-----------------
java.home = jettyfolder/jetty-9.3.9/jdk1.8.0_91/jre
java.vm.vendor = Oracle Corporation
java.vm.version = 25.91-b14
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.info = mixed mode
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_91-b14
java.io.tmpdir = /tmp
user.dir = jettyfolder/jetty-9.3.9/myappbase
user.language = de
user.country = DE
Jetty Environment:
-----------------
jetty.version = 9.3.9.v20160517
jetty.tag.version = master
jetty.home = jettyfolder/jetty-9.3.9
jetty.base = jettyfolder/jetty-9.3.9/myappbase
Config Search Order:
--------------------
<command-line>
${jetty.base} -> jettyfolder/jetty-9.3.9/myappbase
${jetty.home} -> jettyfolder/jetty-9.3.9
JVM Arguments:
--------------------
-Xbootclasspath/p:lib/alpn/alpn-boot-8.1.7.v20160121.jar
System Properties:
------------------
(no system properties specified)
Properties:
-----------
java.version = 1.8.0_91
java.version.major = 1
java.version.minor = 8
java.version.revision = 0
java.version.update = 91
jetty.ssl.port = 8200
jetty.sslContext.keyManagerPassword = SOMEPASSWORD(placehoder)
jetty.sslContext.keyStorePassword = SOMEPASSWORD(placehoder)
jetty.sslContext.keyStorePath = etc/keystore
jetty.sslContext.trustStorePassword = SOMEPASSWORD(placehoder)
jetty.sslContext.trustStorePath = etc/keystore
Jetty Server Classpath:
-----------------------
Version Information on 15 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
changes to the --module=name command line options will be reflected here.
changes to the --module=name command line options will be reflected here.
0: 3.1.0 | ${jetty.home}/lib/servlet-api-3.1.jar
1: 3.1.0.M0 | ${jetty.home}/lib/jetty-schemas-3.1.jar
2: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-http-9.3.9.v20160517.jar
3: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-server-9.3.9.v20160517.jar
4: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-xml-9.3.9.v20160517.jar
5: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-util-9.3.9.v20160517.jar
6: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-io-9.3.9.v20160517.jar
7: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-security-9.3.9.v20160517.jar
8: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-servlet-9.3.9.v20160517.jar
9: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-alpn-server-9.3.9.v20160517.jar
10: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-webapp-9.3.9.v20160517.jar
11: 9.3.9.v20160517 | ${jetty.home}/lib/jetty-deploy-9.3.9.v20160517.jar
12: 9.3.9.v20160517 | ${jetty.home}/lib/http2/http2-common-9.3.9.v20160517.jar
13: 9.3.9.v20160517 | ${jetty.home}/lib/http2/http2-hpack-9.3.9.v20160517.jar
14: 9.3.9.v20160517 | ${jetty.home}/lib/http2/http2-server-9.3.9.v20160517.jar
Jetty Active XMLs:
------------------
${jetty.home}/etc/jetty.xml
${jetty.home}/etc/jetty-ssl.xml
${jetty.home}/etc/jetty-ssl-context.xml
${jetty.home}/etc/jetty-alpn.xml
${jetty.home}/etc/jetty-deploy.xml
${jetty.home}/etc/jetty-http2.xml
${jetty.home}/etc/jetty-https.xml
Finally I found a solution:
Instead of adding
-DSTOP.PORT=PORT -DSTOP.KEY=secret
to the call of the java binary, I simply added it to the start.ini
file of the jetty server.
The first two lines of my start.ini
now looks like:
-DSTOP.PORT=PORT
-DSTOP.KEY=secret
and it works! I guess the exact position in the configuration file does not matter. Also both parameters are now not longer visible with px aux
.