Json - Execute Multiple Queries Using JSONPath] ERROR (com.nolio.platform.shared.datamodel.Action:133) -
Exception caught: java.lang.NoSuchFieldError: defaultReader
nolio_all:
[job-9559308-jobServer-13357884-5:JSON - Extract Release Id List(P1145509563000.F1145509570000.
E1145509574000.E1145509572000):Json - Execute Multiple Queries Using JSONPath] ERROR (com.nolio.
platform.shared.datamodel.Action:133) - Exception caught: java.lang.NoSuchFieldError: defaultReader
java.lang.NoSuchFieldError: defaultReader at com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.<init>
(JsonSmartJsonProvider.java:39)
The error in the log is "java.lang.NoSuchFieldError: defaultReader". This error is java (not a library) saying
that it was instructed to access a java Field. In this case, defaultReader. It made this request via the json-path
JsonSmartJsonProvider class. Reviewing the code of the json-path-2.0.0.jar file, they found that the
JsonSmartJsonProvider attempts to create a JSONValue object:
public JsonSmartJsonProvider()
{
this(-1, JSONValue.defaultReader.DEFAULT_ORDERED);
}
The line "this(-1)..." above is the same line reflected in the error message stack. The json-path library uses the
following line to get access to the JSONValue objects: import net.minidev.json.JSONValue;
The library (aka jar) that supplies that object is the json-smart-2.2.1.jar. Digging into the code for that library
and found that json-smart-2.2.1.jar does have this defaultReader field while json-smart-1.2.jar does not (nowehere
else in your actionslib folder except packaged inside of those jar files). The classes from the json-smart-1.2.jar file
seem to be getting used instead of the classes from the appropriate json-smart-2.2.1.jar file.
Release : 6.7 and above
So, according to the above description it might be related to a lib version issue. We found that in the past there
where some problems with old json action libraries on the agent.
Looking at the logs from the good agent and searched for all occurrences of jsonvalue, found one message:
wrapper.log:INFO | jvm 1 | [Loaded net.minidev.json.JSONValue from file:
/D:/CA/ReleaseAutomationAgent/actionslib/json-smart-2.2.1.jar]
This is the class that does have the defaultReader field and is why it doesn't error out.
The action executed by the agent uses json-path library (2.0.0) to parse the JSON structure. This library uses the
json-smart (2.2.1) library which contains the JSONValue class. This class has the defaultReader member so you
should not face the issue reported.
The binaries of the the agent folder and looks like there might have a conflicting in the class path. There was a
nolio-endevor-v2-actions-10.2.1504.1.jar in the actionsLib folder and this jar file contains the
net.minidev.json.JSONValue class which might have different implementation from the one that is used by the
json-path. The mentioned action pack is deprecated and it was removed by the integration team so this action
pack should not be used by the customer. The customer confirmed that this action pack was really not needed
or could be removed. In case this actionpack is used the suggestion is upgrading it to the version 10.2.1505.1
as it does not have embedded net.minidev.json classes.
For this use case the solution was to remove correctly the action pack endevor-v2 (CA Release Automation
Endevor action pack). It must be removed first from the DB in the management page, then from the actionsLib
folder. Otherwise the file will be restored from the repository.