Java Maven jmeter插件:SAXParseException:prolog中不允许包含内容
我在jmeter的jmx文件中有类似的内容:Java Maven jmeter插件:SAXParseException:prolog中不允许包含内容,java,maven,jmeter,jmeter-plugins,jmeter-maven-plugin,Java,Maven,Jmeter,Jmeter Plugins,Jmeter Maven Plugin,我在jmeter的jmx文件中有类似的内容: <stringProp name="SoapSampler.URL_DATA">http://192.168.0.1:8080/abc/Service</stringProp> http://192.168.0.1:8080/abc/Service 在进行maven构建时,我使用jmetermaven插件获得性能测试结果。它工作得很好 现在我在jmeter中将其更改为用户定义的变量,并尝试运行该变量。我得到以下错误: “S
<stringProp name="SoapSampler.URL_DATA">http://192.168.0.1:8080/abc/Service</stringProp>
http://192.168.0.1:8080/abc/Service
在进行maven构建时,我使用jmetermaven插件获得性能测试结果。它工作得很好
现在我在jmeter中将其更改为用户定义的变量,并尝试运行该变量。我得到以下错误:
“SAXParseException:prolog中不允许包含内容”
jmx文件中的更改:
<elementProp name="server" elementType="Argument">
<stringProp name="Argument.name">server</stringProp>
<stringProp name="Argument.value">http://192.168.0.1:8080</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<stringProp name="SoapSampler.URL_DATA">${server}/abc/Service</stringProp>
服务器
http://192.168.0.1:8080
=
${server}/abc/Service
但是,如果直接从jmeter GUI执行修改后的更改,则可以完美地工作。仅在maven构建期间执行时失败
以下是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.def.performance</groupId>
<artifactId>abc-performance</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-analysis-maven-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>analyze</goal>
</goals>
<configuration>
<!-- An AntPath-Style pattern matching a JMeter XML result file to
analyze. Must be a fully qualified path. File may be GZiped, must end in
.gz then. Default: not set. Required. -->
<source>${project.build.directory}/**/*.jtl</source>
<!-- directory where to store analysis result files. Default: ${project.build.directory}
Required. -->
<targetDirectory>${project.build.directory}/results</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
4.0.0
com.abc.def.performance
abc业绩
0.0.1-快照
罐子
UTF-8
com.lazerycode.jmeter
jmetermaven插件
1.9.0
jmeter测试
验证
性能测试
com.lazerycode.jmeter
jmeter分析maven插件
验证
分析
${project.build.directory}/***.jtl
${project.build.directory}/results
确保
jmeter.save.saveservice.output\u format=xml
和
取消对jmeter.properties文件(在jmeter安装文件夹的bin文件夹中)以下行的注释:
当结果文件不是xml格式时,xml解析器会触发此特定错误消息。结果文件可能是CSV格式的,因为
output\u format
未设置为XML您可以发布pom.XML吗?您可以创建一个空文件,复制pom内容,然后用UTF-8编码再次保存,然后再次尝试运行。@Balaji这没有意义。我们不会更改pom文件。当我们修改jmx文件以使用用户定义的变量时,会出现此错误。但是您提到,当您正常运行jmeter时,它可以正常工作,只有当您运行pom时,它才会失败。看起来您的pom有“bom字节顺序标记”。这就是为什么要求你做上述工作。对于没有用户定义变量的初始情况,相同的pom工作。只有当我们在jmx中添加用户定义的变量时,问题才会出现。
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true