通过 JMeter 插件管理器获取 org.xml.sax.SAXParseException 但 JMeter 工具能够 运行 测试
Getting org.xml.sax.SAXParseException via JMeter Plugins manager but JMeter tool is able to run the test
使用 JMeter v5.4.3 和 Jmeter plugins manager CMD (v1.7):
我们在 运行 JMX 上的 jmeter 插件管理器和所需的插件 未安装 时收到以下错误,但令人惊讶的是,相同的 JMX 是 运行 在 JMeter 上很好。我们在这里遗漏了什么吗?
{"asctime": "2022-03-24 07:32:29,478", "name": "execOp", "levelname": "INFO", "correlationId": "1e519b37-d640-48bb-b2c8-c8dea8bbb010", "servicename": "JMeter Job Agent", "classname": "execOp", "testRunId": "b4969e62-5a1c-446f-8602-d584dd54cd25", "testRunName": "1e519b37-d640-48bb-b2c8-c8dea8bbb00e", "message": "['PluginsManagerCMD.sh', 'install-for-jmx', '/root/artifacts/testplan.jmx']"}
2022-03-24 07:32:30,367 INFO o.j.r.PluginManagerCMD: Command is: install-for-jmx
2022-03-24 07:32:30,418 INFO o.j.r.JARSourceHTTP: Requesting https://jmeter-plugins.org/repo/?installID=linux-a07ec75f950934652462a757ae53bcb4-nongui
2022-03-24 07:32:31,424 INFO o.j.r.PluginManager: Plugins Status: [jpgc-plugins-manager=1.7, jmeter-core=5.4.3, jmeter-ftp=5.4.3, jmeter-http=5.4.3, jmeter-jdbc=5.4.3, jmeter-jms=5.4.3, jmeter-junit=5.4.3, jmeter-java=5.4.3, jmeter-ldap=5.4.3, jmeter-mail=5.4.3, jmeter-mongodb=5.4.3, jmeter-native=5.4.3, jmeter-tcp=5.4.3, jmeter-components=5.4.3]
2022-03-24 07:32:31,426 INFO o.j.r.PluginManagerCMD: Params line is: /root/artifacts/testplan.jmx
2022-03-24 07:32:31,499 WARN o.j.r.p.TestPlanAnalyzer: Cannot parse file: /root/artifacts/testplan.jmx
org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[xercesImpl-2.12.0.jar:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[xercesImpl-2.12.0.jar:?]
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) ~[?:?]
at org.jmeterplugins.repository.plugins.TestPlanAnalyzer.getNodeListWithClassNames(TestPlanAnalyzer.java:112) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.plugins.TestPlanAnalyzer.analyze(TestPlanAnalyzer.java:37) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.plugins.PluginSuggester.analyzeTestPlan(PluginSuggester.java:51) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.PluginManagerCMD.installPluginsForJmx(PluginManagerCMD.java:127) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.PluginManagerCMD.processParams(PluginManagerCMD.java:81) [jmeter-plugins-manager-1.7.jar:?]
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:62) [cmdrunner-2.2.jar:?]
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:21) [cmdrunner-2.2.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:115) [cmdrunner-2.2.jar:?]
2022-03-24 07:32:31,516 INFO o.j.r.JARSourceHTTP: Downloading: http://search.maven.org/remotecontent?filepath=net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
2022-03-24 07:32:31,517 INFO o.j.r.PluginManagerCMD: Downloading json-lib...
2022-03-24 07:32:31,793 INFO o.j.r.PluginManagerCMD: Downloaded json-lib...
2022-03-24 07:32:31,795 INFO o.j.r.PluginManager: Plugins manager will apply some modifications
为什么“令人惊讶”?您的 .jmx 脚本文件包含 XML.
中不允许的字符 null character
JMeter 会忽略这一点以提供最大的灵活性,而 JMeter 插件管理器不会。
插件管理器是一个 separate project,它与 JMeter 上游没有任何关系。
此外,这是一条 WARN
严重程度的消息,因此您可以忽略它(或者如果它导致自动日志分析出现问题,您可以 configure JMeter logging 通过添加下一行来不显示此警告log4j2.xml 文件)
<Logger name="org.jmeterplugins.repository.plugins.TestPlanAnalyzer" level="error" />
使用 JMeter v5.4.3 和 Jmeter plugins manager CMD (v1.7):
我们在 运行 JMX 上的 jmeter 插件管理器和所需的插件 未安装 时收到以下错误,但令人惊讶的是,相同的 JMX 是 运行 在 JMeter 上很好。我们在这里遗漏了什么吗?
{"asctime": "2022-03-24 07:32:29,478", "name": "execOp", "levelname": "INFO", "correlationId": "1e519b37-d640-48bb-b2c8-c8dea8bbb010", "servicename": "JMeter Job Agent", "classname": "execOp", "testRunId": "b4969e62-5a1c-446f-8602-d584dd54cd25", "testRunName": "1e519b37-d640-48bb-b2c8-c8dea8bbb00e", "message": "['PluginsManagerCMD.sh', 'install-for-jmx', '/root/artifacts/testplan.jmx']"}
2022-03-24 07:32:30,367 INFO o.j.r.PluginManagerCMD: Command is: install-for-jmx
2022-03-24 07:32:30,418 INFO o.j.r.JARSourceHTTP: Requesting https://jmeter-plugins.org/repo/?installID=linux-a07ec75f950934652462a757ae53bcb4-nongui
2022-03-24 07:32:31,424 INFO o.j.r.PluginManager: Plugins Status: [jpgc-plugins-manager=1.7, jmeter-core=5.4.3, jmeter-ftp=5.4.3, jmeter-http=5.4.3, jmeter-jdbc=5.4.3, jmeter-jms=5.4.3, jmeter-junit=5.4.3, jmeter-java=5.4.3, jmeter-ldap=5.4.3, jmeter-mail=5.4.3, jmeter-mongodb=5.4.3, jmeter-native=5.4.3, jmeter-tcp=5.4.3, jmeter-components=5.4.3]
2022-03-24 07:32:31,426 INFO o.j.r.PluginManagerCMD: Params line is: /root/artifacts/testplan.jmx
2022-03-24 07:32:31,499 WARN o.j.r.p.TestPlanAnalyzer: Cannot parse file: /root/artifacts/testplan.jmx
org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[xercesImpl-2.12.0.jar:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[xercesImpl-2.12.0.jar:?]
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) ~[?:?]
at org.jmeterplugins.repository.plugins.TestPlanAnalyzer.getNodeListWithClassNames(TestPlanAnalyzer.java:112) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.plugins.TestPlanAnalyzer.analyze(TestPlanAnalyzer.java:37) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.plugins.PluginSuggester.analyzeTestPlan(PluginSuggester.java:51) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.PluginManagerCMD.installPluginsForJmx(PluginManagerCMD.java:127) [jmeter-plugins-manager-1.7.jar:?]
at org.jmeterplugins.repository.PluginManagerCMD.processParams(PluginManagerCMD.java:81) [jmeter-plugins-manager-1.7.jar:?]
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:62) [cmdrunner-2.2.jar:?]
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:21) [cmdrunner-2.2.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:115) [cmdrunner-2.2.jar:?]
2022-03-24 07:32:31,516 INFO o.j.r.JARSourceHTTP: Downloading: http://search.maven.org/remotecontent?filepath=net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
2022-03-24 07:32:31,517 INFO o.j.r.PluginManagerCMD: Downloading json-lib...
2022-03-24 07:32:31,793 INFO o.j.r.PluginManagerCMD: Downloaded json-lib...
2022-03-24 07:32:31,795 INFO o.j.r.PluginManager: Plugins manager will apply some modifications
为什么“令人惊讶”?您的 .jmx 脚本文件包含 XML.
中不允许的字符 null characterJMeter 会忽略这一点以提供最大的灵活性,而 JMeter 插件管理器不会。
插件管理器是一个 separate project,它与 JMeter 上游没有任何关系。
此外,这是一条 WARN
严重程度的消息,因此您可以忽略它(或者如果它导致自动日志分析出现问题,您可以 configure JMeter logging 通过添加下一行来不显示此警告log4j2.xml 文件)
<Logger name="org.jmeterplugins.repository.plugins.TestPlanAnalyzer" level="error" />