If a custom JavaSampler is used and the class can not be found during JMeter startup, then JMeter silently resets the class name in the JavaSampler to the first (default) class. There's no idication in the GUI about the problem (except if you start looking at the class name drop down) and when you close the test plan, JMeter informs you the test plan has changed and that you should save it. If you save it, then the original class name information is no longer included in the test plan. I'm not sure what behavior is better, but silently overwriting the class name in the test with the default class name doesn't seem right. Perhaps a warning popup if the class name from the test plan can not be found, keeping the name and either skip the problematic samplers or somehow disable execution of the plan?
I think the problem happens in JavaConfigGui: 223 public void configure(TestElement config) { 224 super.configure(config); 225 226 argsPanel.configure((Arguments) config.getProperty(JavaSampler.ARGUMENTS).getObjectValue()); 227 228 classnameCombo.setSelectedItem(config.getPropertyAsString(JavaSampler.CLASSNAME)); 229 } Since the combo box is not editable, the setSelectedItem() call for a claqss name that wasn't found during load will not change the selected value which by default simply is the first enty in the values list of the combo box.
Date: Mon Oct 14 21:50:26 2013 New Revision: 1532114 URL: http://svn.apache.org/r1532114 Log: Bug 55652 - JavaSampler silently resets classname if class can not be found Add as a minimum an error log Bugzilla Id: 55652 Modified: jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
We could also add an empty item in combo and default to it when not found
(In reply to Philippe Mouawad from comment #3) > We could also add an empty item in combo and default to it when not found I think it would be better to show the desired classname, even if it is not present. Otherwise testplans will potentially be changed if they are run from an environment where the class is missing. However this might be tricky to implement whilst still allowing selection of available classes. Ideally if the class name is specified in the test plan, it should be shown in the drop-down regardless of whether it exists or not. Maybe the entry could be shown in a different colour if it is missing? The rest of the drop-down would be populated as normal. We'll have to see how that affects behaviour if the selection is changed as this will depend on when the stored value is updated. If it proves too difficult to implement without being confusing, I agree that using an empty item - or possibly a special 'Missing' item? - would be better than changing to another class name.
Author: pmouawad Date: Tue Jan 24 22:18:10 2017 New Revision: 1780121 URL: http://svn.apache.org/viewvc?rev=1780121&view=rev Log: Bug 55652 - JavaSampler silently resets classname if class can not be found Bugzilla Id: 55652 Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java jmeter/trunk/xdocs/changes.xml
Reopening due to regression: When Element is added parameters are not set
Author: pmouawad Date: Tue Feb 7 21:33:49 2017 New Revision: 1782083 URL: http://svn.apache.org/viewvc?rev=1782083&view=rev Log: Bug 55652 - JavaSampler silently resets classname if class can not be found Fix regression: When Element is added parameters are not set and improve warning Bugzilla Id: 55652 Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3252