尝试通过 jmeter-maven-plugin 使用 Jmeter 加载 SSL 密钥库失败
Attempt to load SSL keystore with Jmeter via jmeter-maven-plugin fails
在使用设置了以下选项的 jmeter-maven-plugin 时,Jmeter 加载密钥库文件时出现问题:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.maven.plugin.version}</version>
<executions>
<!-- defines a runner for jmeter tests project -->
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<resultsDirectory>${project.build.directory}/jmeter/results</resultsDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<suppressJMeterOutput>false</suppressJMeterOutput>
<resultsFileFormat>xml</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<appendResultsTimestamp>false</appendResultsTimestamp>
<testFilesIncluded>
<jMeterTestFile>Service-Tests.jmx</jMeterTestFile>
</testFilesIncluded>
<propertiesSystem>
<javax.net.ssl.keyStore>jmeterTrustedKeystore.jks</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>changeit</javax.net.ssl.keyStorePassword>
</propertiesSystem>
</configuration>
</execution>
</executions>
</plugin>
我得到的错误是:
2015/01/22 10:48:38 INFO - jmeter.util.SSLManager: JmeterKeyStore Location: type JKS
2015/01/22 10:48:38 INFO - jmeter.util.SSLManager: KeyStore created OK
2015/01/22 10:48:38 WARN - jmeter.util.SSLManager: Keystore file not found, loading empty keystore
我不明白为什么找不到文件,因为 jMeterTestFile 参数显然似乎有效。我做错了什么?
试试这个解决方案:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.maven.plugin.version}</version>
<executions>
<!-- defines a runner for jmeter tests project -->
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<resultsDirectory>${project.build.directory}/jmeter/results</resultsDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<suppressJMeterOutput>false</suppressJMeterOutput>
<resultsFileFormat>xml</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<appendResultsTimestamp>false</appendResultsTimestamp>
<testFilesIncluded>
<jMeterTestFile>Service-Tests.jmx</jMeterTestFile>
</testFilesIncluded>
<jMeterProcessJVMSettings>
<arguments>
<argument>-Djavax.net.ssl.keyStore=jmeterTrustedKeystore.jks</argument>
<argument>-Djavax.net.ssl.keyStorePassword=changeit</argument>
</arguments>
</jMeterProcessJVMSettings>
</configuration>
</execution>
</executions>
</plugin>
在使用设置了以下选项的 jmeter-maven-plugin 时,Jmeter 加载密钥库文件时出现问题:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.maven.plugin.version}</version>
<executions>
<!-- defines a runner for jmeter tests project -->
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<resultsDirectory>${project.build.directory}/jmeter/results</resultsDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<suppressJMeterOutput>false</suppressJMeterOutput>
<resultsFileFormat>xml</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<appendResultsTimestamp>false</appendResultsTimestamp>
<testFilesIncluded>
<jMeterTestFile>Service-Tests.jmx</jMeterTestFile>
</testFilesIncluded>
<propertiesSystem>
<javax.net.ssl.keyStore>jmeterTrustedKeystore.jks</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>changeit</javax.net.ssl.keyStorePassword>
</propertiesSystem>
</configuration>
</execution>
</executions>
</plugin>
我得到的错误是:
2015/01/22 10:48:38 INFO - jmeter.util.SSLManager: JmeterKeyStore Location: type JKS
2015/01/22 10:48:38 INFO - jmeter.util.SSLManager: KeyStore created OK
2015/01/22 10:48:38 WARN - jmeter.util.SSLManager: Keystore file not found, loading empty keystore
我不明白为什么找不到文件,因为 jMeterTestFile 参数显然似乎有效。我做错了什么?
试试这个解决方案:
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>${jmeter.maven.plugin.version}</version>
<executions>
<!-- defines a runner for jmeter tests project -->
<execution>
<id>jmeter-tests</id>
<phase>test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<resultsDirectory>${project.build.directory}/jmeter/results</resultsDirectory>
<ignoreResultFailures>true</ignoreResultFailures>
<suppressJMeterOutput>false</suppressJMeterOutput>
<resultsFileFormat>xml</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<appendResultsTimestamp>false</appendResultsTimestamp>
<testFilesIncluded>
<jMeterTestFile>Service-Tests.jmx</jMeterTestFile>
</testFilesIncluded>
<jMeterProcessJVMSettings>
<arguments>
<argument>-Djavax.net.ssl.keyStore=jmeterTrustedKeystore.jks</argument>
<argument>-Djavax.net.ssl.keyStorePassword=changeit</argument>
</arguments>
</jMeterProcessJVMSettings>
</configuration>
</execution>
</executions>
</plugin>