Getting Malformed Json Exception when using Service Virtualization plugin.

book

Article ID: 127151

calendar_today

Updated On:

Products

CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder) CA Service Virtualization (DevTest / LISA / VSE / Application Test)

Issue/Introduction

We are getting the following error when using the Jenkins plugin to build the pipeline.

com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $ 
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1568) 
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1409) 
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) 
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) 
at com.google.gson.JsonParser.parse(JsonParser.java:60) 
Caused: com.google.gson.JsonSyntaxException 
...

The response seems a valid JSON response, but we still get this exception.
 

Environment

DevTest on release 10.3.

Resolution

Upgrade the ca-service-virtualization.hpi plugin to Jenkins. 
More information can be found in the link below:
CA Service Virtualization and Jenkins making Continuous Integration and Testing Better Together
In Jenkins, go to “manage Jenkins -> manage plugins -> Advanced” and upload plugin, the existing one will be updated.

After the plugin was upgraded, we started getting the error message:
15:21:01 {"_links":{"self":{"href":"http://qmopts.phx.aa.com:1505/lisa-test-invoke/api/v1/tests/run/6X999X9999X99x9X9000090999X9X99"}},"id":"6X999X9999X99x9X9000090999X9X99","name":"VSM-name (Run1User1Cycle)","runType":"TEST","runBy":"X1234567","testStatus":"INITIATED","manuallyTerminated":false}
15:21:01 Test/Suite from MAR file was successfully deployed, id = 6X999X9999X99x9X9000090999X9X99
15:21:02 Charset: null, Locale: en_US 
15:21:02 MimeType: application/json 
15:21:02 Status Check Body: {"id":401,"message":"Authorization failed"} 
... 
Finished: FAILURE 

When running a test from Postman we were getting the same exceptions when trying with different users.
There is a patch available for this issue described in the link below:
lisa-virtualize-invoke API URL gives authorization error when using LDAP credentials

The fix delivered with DE357218 was applied in the Registry server under $DEVTEST_HOME/lib/patches and we were able to run the test and get valid responses this time.