Matthew Haarsager
Matthew Haarsager

Reputation: 31

error when trying to open a jmx file in jMeter (only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen.. )

[Hi, I am trying to open a test plan which I copied the code from github, entered into text editor, changed file to .jmx - navigated to jmeter and tried to open the jmx file and I get the following error. Any ideas on how I can open this test script in jmeter?

I am on mac big sur and using jmeter 5.4.1

message

Upvotes: 3

Views: 4360

Answers (3)

Michael Johnson
Michael Johnson

Reputation: 105

In my case I was downloading the .jmx file from github and then trying to open it in JMeter. To get around the issue I copied the 'Code' from github and put it in Notepad ++ and then saved it as a .jmx file and JMeter was then able to open the script.

Upvotes: 0

Colin Rudd
Colin Rudd

Reputation: 93

On a Windows 10 machine, I had the same problem and the XML in my .jmx file was well formed. Multiple validators confirmed this. The .jmx was originally created/saved from the same jMeter 5.5 app that was now not able to open it.

The issue turned out to be that my .jmx file had a BOM character at the start, which jMeter was not handling.

(Maybe after saving the file from jMeter I had re-opened it in VSCode and (maybe) saved it there and a BOM char got added to the beginning.)

Re-saving the file in VSCode with a different encoding to try to correct the issue was not successful, so I ended up creating a new blank file via VI in GitBash, and then just copying all of the XML into VI from the VSCode editor, and saving the new file from VI. The BOM char thankfully does not get copied to the clipboard.

jMeter had no problem opening the new file I created and saved in VI.

Upvotes: 1

Dmitri T
Dmitri T

Reputation: 168217

JMeter .jmx scripts are basically XML files and the error indicates that the XML is not well-formed so I can think of 2 possible options:

  1. The file you're trying to open is not valid JMeter script/XML file
  2. You're not good at copying and pasting

Actually trying to launch code from untrusted source without understanding what it does is not the best idea as I can post here a JMeter script which will delete all your files and start mining cryptocurrency so I would recommend building your test plan yourself, if it's HTTP protocol you can even record it using HTTP(S) Test Script Recorder or JMeter Chrome Extension

Upvotes: 0

Related Questions