Bug 57956 - The hc.parameters reference in jmeter.properties doesn't work when JMeter is not started in bin
Summary: The hc.parameters reference in jmeter.properties doesn't work when JMeter is ...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.13
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-27 16:12 UTC by Michael Aichlmayr
Modified: 2015-06-13 21:33 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Aichlmayr 2015-05-27 16:12:31 UTC
There is a reference in the jmeter.properties file:

# define a properties file for overriding Apache HttpClient parameters
# See: TBA
# Uncomment this line if you put anything in hc.parameters file
#hc.parameters.file=hc.parameters

Setup:

1. HttpClient4 used in script.

2. In jmeter.properties, uncomment the line:

     #hc.parameters.file=hc.parameters

3. In the file httpclient.parameters uncomment and modify:

     #http.authentication.preemptive$Boolean=true

   to:

     http.authentication.preemptive$Boolean=false

4. In user.properties, add the line:

     httpclient4.retrycount=1

5. In hc.parameters, uncomment and modify:

     #http.connection.stalecheck$Boolean=false

   to:

     http.connection.stalecheck$Boolean=true


Script is in its own project folder. JMeter bin is specified on the path.

Issue:

When script is run, the following error is written to the log file:

ERROR - jmeter.protocol.http.sampler.HttpClientDefaultParameters: Problem loading properties java.io.FileNotFoundException: hc.parameters (The system cannot find the file specified)

Work-around:

If EITHER the hc.parameters file is copied into the folder where JMeter is started (ugly)

OR the line:

  hc.parameters.file=hc.parameters

is added to the file user.properties (less ugly but not documented usage), the error does not occur.
Comment 1 Sebb 2015-05-27 18:36:34 UTC
(In reply to Michael Aichlmayr from comment #0)

> OR the line:
> 
>   hc.parameters.file=hc.parameters
> 
> is added to the file user.properties (less ugly but not documented usage),
> the error does not occur.

That does not make sense.
The entries from user.properties are merged with the ones from jmeter.properties, so it does not matter where the property is defined.
I just tried.

==

JMeter uses the path name to open the file.
If you use a relative path name then it does not currently check the home directory as well. This is not a bug.
Comment 2 Philippe Mouawad 2015-05-27 18:38:28 UTC
It does not make sense at first look but I reproduce the bug.
Comment 3 Michael Aichlmayr 2015-05-28 16:25:27 UTC
OK. I have made a fresh installation of JMeter and I believe I have resolved the problem, but there is still appears to be an issue, so I am not going to mark this resolved yet.

It turns out that I didn't uncomment the line in jmeter.properties for httpclient.parameters.file which is required because I have modified the file httpclient.parameters.

By changing (in addition to the original customizations above):

  #httpclient.parameters.file=httpclient.parameters

to:

  httpclient.parameters.file=httpclient.parameters

the error:
  ERROR - jmeter.protocol.http.sampler.HttpClientDefaultParameters:
    Problem loading properties java.io.FileNotFoundException: hc.parameters
    (The system cannot find the file specified)

goes away.

So it would appear that either the error is wrong, or uncommenting the hc.parameters.file line requires the httpclient.parameters.file line to be uncommented as well or for some reason the hc.parameters file cannot be found (doesn't make sense to me, but maybe there is a logical explanation).
Comment 4 Sebb 2015-05-28 17:52:51 UTC
There are two different parameters files; one for Apache Commons HttpClient (property: httpclient.parameters.file) and the other for Apache HttpComponents HttpClient (property: hc.parameters.file).

The relevant file is opened when the sampler class is loaded, which will only occur if there is an instance of the relevant sampler in the test plan *and* the property is defined.

It does not make sense to edit the httpclient.parameters file, nor enable the property httpclient.parameters.file if the test plan only uses HttpClient4
Comment 5 Michael Aichlmayr 2015-05-28 18:05:21 UTC
It specifically says in the jmeter.properties file, uncomment the line:

#httpclient.parameters.file=httpclient.parameters

if you put anything in httpclient.parameters.

It specifically says in the jmeter.properties file, uncomment the line:

#hc.parameters.file=hc.parameters

if you put anything in hc.parameters.

If you read my original settings, you will see that I do modify (add something to)
both of these files.

When the line:

  #hc.parameters.file=hc.parameters

is uncommented without uncommenting the line:

  #httpclient.parameters.file=httpclient.parameters

JMeter reports that it cannot open hc.parameters. This makes no sense.
Comment 6 Sebb 2015-05-29 00:10:36 UTC
(In reply to Michael Aichlmayr from comment #5)
> It specifically says in the jmeter.properties file, uncomment the line:
> 
> #httpclient.parameters.file=httpclient.parameters
> 
> if you put anything in httpclient.parameters.
> 
> It specifically says in the jmeter.properties file, uncomment the line:
> 
> #hc.parameters.file=hc.parameters
> 
> if you put anything in hc.parameters.

Yes.

> If you read my original settings, you will see that I do modify (add
> something to)
> both of these files.

But if the test only uses HttpClient4, then updating httpclient.parameters makes no sense. Nor does it make sense to enable the property httpclient.parameters.file.
Neither action will have any effect on the test, because they only apply to the HttpClient3.1 sampler.

> When the line:
> 
>   #hc.parameters.file=hc.parameters
> 
> is uncommented without uncommenting the line:
> 
>   #httpclient.parameters.file=httpclient.parameters
> 
> JMeter reports that it cannot open hc.parameters. This makes no sense.

When I try the same test, the log shows it cannot open hc.parameters
This is expected because the file is in bin, not in the current directory.

This error happens regardless of the setting of httpclient.parameters.file.

The *.parameters.file properties are independent.
Comment 7 Michael Aichlmayr 2015-06-01 15:35:07 UTC
You are right. It does happen regardless of whether or not httpclient.parameters.file is exposed or not. When I retested, I realized that I was thrown off by the fact that the error only happens once per startup. That is, when I start JMeter, load a test-plan, and run the test-plan, the error occurs. If I run the test-plan a second time, the error does not occur. Because I was not aware of this behavior, my edit of jmeter.properties appeared to fix it when in fact it was only that the error had already occurred once.

Regards settings, we have many tens of JMeter projects and try to have a base configuration that works with the majority of them. Some of the settings I reported may not make sense for what I was doing at the time that I discovered the issue I was reporting.

I am puzzled that only the hc.parameters file is expected to be in the current folder when all the other files are found in bin regardless of the startup folder (at least that has been my experience). The way we use JMeter to-date is to start in a project folder so that logs and all output is relative to the project and the JMeter installation does not get polluted with run-data.
Comment 8 Philippe Mouawad 2015-06-13 21:33:03 UTC
Date: Sat Jun 13 21:17:47 2015
New Revision: 1685333

URL: http://svn.apache.org/r1685333
Log:
Bug 57956 - The hc.parameters reference in jmeter.properties doesn't work when JMeter is not started in bin
Bugzilla Id: 57956

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/xdocs/changes.xml


Date: Sat Jun 13 21:32:18 2015
New Revision: 1685335

URL: http://svn.apache.org/r1685335
Log:
Bug 57956 - The hc.parameters reference in jmeter.properties doesn't work when JMeter is not started in bin
Rollback and fix differently.
Bugzilla Id: 57956

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpClientDefaultParameters.java
Comment 9 The ASF infrastructure team 2022-09-24 20:38:00 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3598