我正在使用Jetty独立版本9.3.9(start.jar)并遇到以下问题:
Jetty已启用SSL,只能通过https访问。 jetty-server的启动和停止由两个shellcripts管理,它们定义了stop-port和stop-key:
java -DSTOP.PORT=PORT -DSTOP.KEY=secret start.jar
PORT和KEY只是占位符
通过--stop
参数,Jetty服务器正确停止。
现在,当启用模块http2
(它完美地工作)并执行停止脚本时,我收到以下错误(第一行被翻译)。
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)
并且服务器没有关闭。使用ps aux
进行检查时,现在还有两个进程,其中一个进程包含以下行,并且在http2
被禁用时也会生成:
java -DSTOP.PORT=PORT -DSTOP.KEY=secret
另一个(新的)包含对java的巨大丑陋调用,看起来它通过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-
......等等。它可能属于ALPN
使用的HTTP/2
。
一旦禁用http2(例如重命名文件夹start.d),再次通过端口和密钥工作。
Edit2,添加了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
答案 0 :(得分:0)
选项-DSTOP.PORT=PORT
声明无效。
该值应为端口号,Jetty具有绑定的权限。
选择一个介于1025和65534之间的数字并使用它。
例如:-DSTOP.PORT=27272
答案 1 :(得分:0)
最后我找到了解决方案:
而不是添加
-DSTOP.PORT=PORT -DSTOP.KEY=secret
调用java二进制文件,我只是将它添加到jetty服务器的start.ini
文件中。
我的start.ini
的前两行现在看起来像:
-DSTOP.PORT=PORT
-DSTOP.KEY=secret
它有效!我猜配置文件中的确切位置无关紧要。此外,px aux
现在也无法再显示这两个参数。