JMeter 4 - 无法在 windows 7 中执行 jmeter-server

JMeter 4 - can't execute jmeter-server in windows 7

我下载了最新的 JMeter 4,

作为 Remote Testing

的一部分

To run JMeter in remote node, start the JMeter server component on all machines you wish to run on by running the JMETER_HOME/bin/jmeter-server (unix) or JMETER_HOME/bin/jmeter-server.bat (windows) script.

我尝试在windows 7中执行jmeter-server.bat 并收到以下错误:

Server failed to start: java.rmi.server.ExportException: Listen failed on port:
0; nested exception is:
        java.io.FileNotFoundException: rmi_keystore.jks (The system cannot find
the file specified)
An error occurred: Listen failed on port: 0; nested exception is:
        java.io.FileNotFoundException: rmi_keystore.jks (The system cannot find
the file specified)
errorlevel=1

似乎缺少文件 rmi_keystore.jks。 (我在 JMeter 文件夹中找不到它)

在 JMeter 3.3 中,jmeter-server.bat 正在运行。

编辑 1

在我执行 create-rmi-keystore.bat 之后它创建了 rmi_keystore.jks,但是我得到了其他错误:

Server failed to start: java.rmi.server.ExportException: Listen failed on port:
0; nested exception is:
        java.io.IOException: java.security.UnrecoverableKeyException: Cannot rec
over key
An error occurred: Listen failed on port: 0; nested exception is:
        java.io.IOException: java.security.UnrecoverableKeyException: Cannot rec
over key
errorlevel=1

日志错误:

2018-02-11 12:09:13,916 ERROR o.a.j.e.DistributedRunner: Failed to create engine at 127.0.0.1
java.rmi.ConnectIOException: Exception creating connection to: 127.0.0.1; nested exception is: 
    java.io.IOException: java.security.UnrecoverableKeyException: Cannot recover key
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) ~[?:1.8.0_25]
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) ~[?:1.8.0_25]
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) ~[?:1.8.0_25]
    at sun.rmi.server.UnicastRef.newCall(Unknown Source) ~[?:1.8.0_25]
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) ~[?:1.8.0_25]
    at org.apache.jmeter.engine.ClientJMeterEngine.getEngine(ClientJMeterEngine.java:70) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.ClientJMeterEngine.<init>(ClientJMeterEngine.java:83) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.createEngine(DistributedRunner.java:237) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.getClientEngine(DistributedRunner.java:213) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.init(DistributedRunner.java:93) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.RemoteStart.doAction(RemoteStart.java:80) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed[=13=](ActionRouter.java:70) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter$$Lambda/2068100669.run(Unknown Source) [ApacheJMeter_core.jar:4.0 r1823414]
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_25]
Caused by: java.io.IOException: java.security.UnrecoverableKeyException: Cannot recover key
    at org.apache.jmeter.rmi.SSLRMIClientSocketFactory.createSocket(SSLRMIClientSocketFactory.java:110) ~[ApacheJMeter_core.jar:4.0 r1823414]
    ... 28 more
Caused by: java.security.UnrecoverableKeyException: Cannot recover key
    at sun.security.provider.KeyProtector.recover(Unknown Source) ~[?:1.8.0_25]
    at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source) ~[?:1.8.0_25]
    at sun.security.provider.JavaKeyStore$JKS.engineGetKey(Unknown Source) ~[?:1.8.0_25]
    at java.security.KeyStore.getKey(Unknown Source) ~[?:1.8.0_25]
    at sun.security.ssl.SunX509KeyManagerImpl.<init>(Unknown Source) ~[?:1.8.0_25]
    at sun.security.ssl.KeyManagerFactoryImpl$SunX509.engineInit(Unknown Source) ~[?:1.8.0_25]
    at javax.net.ssl.KeyManagerFactory.init(Unknown Source) ~[?:1.8.0_25]
    at org.apache.jmeter.rmi.SSLRMIClientSocketFactory.createSocket(SSLRMIClientSocketFactory.java:103) ~[ApacheJMeter_core.jar:4.0 r1823414]
    ... 28 more
2018-02-11 12:09:24,368 INFO o.a.j.e.DistributedRunner: Failed to configure 127.0.0.1
2018-02-11 12:09:24,369 INFO o.a.j.e.DistributedRunner: Stopping remote engines
2018-02-11 12:09:24,370 INFO o.a.j.e.DistributedRunner: Remote engines have been stopped
2018-02-11 12:09:24,370 ERROR o.a.j.g.a.ActionRouter: Error processing org.apache.jmeter.gui.action.RemoteStart@3249a1ce
java.lang.RuntimeException: Following remote engines could not be configured:[127.0.0.1]
    at org.apache.jmeter.engine.DistributedRunner.init(DistributedRunner.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.RemoteStart.doAction(RemoteStart.java:80) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed[=13=](ActionRouter.java:70) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.gui.action.ActionRouter$$Lambda/2068100669.run(Unknown Source) [ApacheJMeter_core.jar:4.0 r1823414]
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.access0(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.run(Unknown Source) [?:1.8.0_25]
    at java.security.AccessController.doPrivileged(Native Method) [?:1.8.0_25]
    at java.security.ProtectionDomain.doIntersectionPrivilege(Unknown Source) [?:1.8.0_25]
    at java.awt.EventQueue.dispatchEvent(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_25]
    at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_25]

编辑 2

我试图将 server.rmi.ssl.keystore.password 更改为我写的密码,但出现了不同的错误

Server failed to start: java.rmi.server.ExportException: Listen failed on port:
0; nested exception is:
        java.io.IOException: Keystore was tampered with, or password was incorre
ct
An error occurred: Listen failed on port: 0; nested exception is:
        java.io.IOException: Keystore was tampered with, or password was incorre
ct

编辑 3

我尝试根据 reference 手动设置服务器端口 SET SERVER_PORT=1099 但仍然尝试通过端口 0

进行监听

On Windows this can be done by: SET SERVER_PORT=

要解决问题,您需要遵循:

问题是执行时第一个问题的答案create-rmi-keystore

What is your first and last name?

我应该回答 rmi 因为它是 JMeter 属性 server.rmi.ssl.keystore.alias

中的默认值

此外(与 JMeter 3.3 的区别)我需要更改 JMeter 的 属性 remote_hosts 以便它使用我的主机名(从 127.0.0.1 更改)

这与 :

有关

我遇到了上述所有问题,直到我找到了解决方案,即:

  • keystorekeyEntry 密码不同时出现错误java.security.UnrecoverableKeyException: Cannot recover key

  • 要解决此问题,您必须删除过去证书和请求文件的所有痕迹。

  • 您必须生成新的 keystore, keyEntryCSR 并为密钥库和 keyEntry 指定相同的密码。

有同样的问题。

要解决这个问题,您有几种选择:

  1. 将 rmi-keystore 密码设置为 changeit,如 jmeter.properties:

    中所述

    信任库密码
    server.rmi.ssl.truststore.password=改变

  2. 如果使用自定义密码 - 将其添加到 jmeter-server 机器上的 user.properties

  3. 通过传递 -Jserver.rmi.ssl.disable=true

  4. 禁用 SSL

对我有用(使用 JMeter 5.0)的是具有以下配置的专用 jmeter-server.properties 文件:

# Type of keystore : JKS
server.rmi.ssl.keystore.type=JKS
#
# Keystore file that contains private key
server.rmi.ssl.keystore.file=rmi_keystore.jks
#
# Password of Keystore
server.rmi.ssl.keystore.password=changeit
#
# Key alias
server.rmi.ssl.keystore.alias=rmi
#
# Type of truststore : JKS
server.rmi.ssl.truststore.type=JKS
#
# Keystore file that contains certificate
server.rmi.ssl.truststore.file=rmi_keystore.jks
#
# Password of Trust store
server.rmi.ssl.truststore.password=changeit

我在 JMeter bin 文件夹中使用 create-rmi-keystore 命令创建了一个 rmi_keystore.jks 文件。然后我用 jmeter-server -Gjmeter-server.properties 启动了我的服务器。还要检查来自服务器的日志,以获取将客户端连接到服务器的端点,如 user7294900 建议的那样。

Created remote object: UnicastServerRef2 [liveRef: [endpoint:[<this is your server>

您的 bin 文件夹中有两个批处理文件。 运行 先是“create-rmi-keystore”文件,然后是“jmeter”