I am trying to read a file into a string so I can split it into an array
and access the elements on a random basis.

Currently, I am trying to use the following code located in a BeanShell
Sampler:

var l_otl_JOB_TITLES;
${__FileToString(job_titles.txt,,l_otl_JOB_TITLES)};
${__split(l_otl_JOB_TITLES,${otl_JOB_TITLES},\n);

When I run this, I get the following in the my jmeter.log:

2012/05/11 14:45:12 WARN  - jmeter.protocol.java.sampler.BeanShellSampler:
org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval
In file: inline evaluation of: ``var l_otl_JOB_TITLES; ${__FileToString
(job_titles.txt,,l_otl_JOB_TITLES)}; ${__s . . . '' Encountered
"( job_titles . txt , ," at line 2, column 17.


I have also tried specifying the file name in a variable, but I get the
same results.

If I change it to:

var l_otl_JOB_TITLES;
${__FileToString(job_titles.txt,UTF-8,l_otl_JOB_TITLES)};

2012/05/11 14:50:32 WARN  - jmeter.protocol.java.sampler.BeanShellSampler:
org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval
Sourced file: inline evaluation of: ``var l_otl_JOB_TITLES; $
{__FileToString(job_titles.txt,UTF-8,l_otl_JOB_TITLES)};  . . . '' :
Attempt to access property on undefined variable or class name


I also noted Bug # 50568
(https://issues.apache.org/bugzilla/show_bug.cgi?id=50568) that certainly
seems related, but that was fixed in 2.4 and I am using 2.6.

I was unable to find any solid examples online.

Can someone please either point me to some clear examples/guides or let me
know what I am doing wrong here?

Also, if there is a better way to do what I am trying to accomplish, I'd
welcome knowing that.

Thank you.

Lee Lowder

This communication and any attachments are confidential, protected by 
Communications Privacy Act 18 USCS § 2510, solely for the use of the intended 
recipient, and may contain legally privileged material. If you are not the 
intended recipient, please return or destroy it immediately. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to