Hi all, We're building our own AbstractJavaSamplerClient but we run into a problem when we want to read a property file using the ClassLoader.getSystemResource method. Whatever we try in regard to the directory/filename (file:///d:/etc/test.properties, d:\etc\test.properties, .\test.properties, test) or the placement of the (in d:\etc, jmeter bin, jmeter lib) the file cannot be found.
If we try the same in a seperate Java client (so without Jmeter) the file can be found?!?! I've added our AbstractJavaSamplerClient below. This client take the filename as parameter (via GUI). Regards, Bob Coret ----------------------------- package org.apache.jmeter.protocol.java.test; import java.io.Serializable; import java.util.Iterator; import java.net.URL; import org.apache.jmeter.config.Arguments; import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient; import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext; import org.apache.jmeter.samplers.SampleResult; public class SystemResourceTest extends AbstractJavaSamplerClient implements Serializable { public static final String DEFAULT_FILE = "d:\\etc\\test.properties"; private String fileName; public SleepTest() { } public void setupTest(JavaSamplerContext context) { fileName= context.getParameter("Filename", DEFAULT_FILE); } public SampleResult runTest(JavaSamplerContext context) { SampleResult results = new SampleResult(); results.sampleStart(); results.setSampleLabel("System Resource Test"); URL epFunctionsConfigURL = ClassLoader.getSystemResource(getFileName()); if (epFunctionsConfigURL == null) { results.setResponseMessage("File '"+getFileName()+"' not found!"); results.setSuccessful(false); } else { results.setResponseMessage("File '"+getFileName()+"' found!"); results.setSuccessful(true); } results.sampleEnd(); return results; } public void teardownTest(JavaSamplerContext context) { } public Arguments getDefaultParameters() { Arguments params = new Arguments(); params.addArgument("Filename", DEFAULT_FILE); return params; } private String getFileName() { return fileName; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]