Purpose (problem description)

This page is a troubleshooting guide for the error "An error occurred  during execution" that occurs while generating report using the GUI as seen in the below screenshot.

*Observed in CAST AIP
Release
Yes/No
1.x(tick)
Observed on RDBMS
RDBMS
Yes/No
CSS (tick)
Step by Step scenario
  1. Launch Report Generator.
  2. Choose the application.
  3. Select the Current & Previous Snapshot.
  4. Select template Execution-summary-sample1.pptx.
  5. Press Generate Report, and you will see the following message "An error occurred during execution" in the right hand side.
Action Plan
  1. Check for mis-configuration that can result in this error
    1. Make sure that the license.key file is not actually a license.key.txt file
      1. The OS settings you use may mask the extension.  See the screenshot below for what the file should look like:
    2. Make sure that the URL used in Report generator conforms to the documentation and includes http at the beginning.
      1. Per documentation here:  CAST Report Generator the URL should be -  http:server[:port]/RestAPI/rest
  2. Activate the Show SQL traces for the RestAPI logs and reproduce the issue. To activate the Show SQL traces refer to the page - Health Dashboard - Information - How to activate SQL traces on AAD and RestAPI logs
  3. Identify the error & the culprit URI in the Report generator log file
  4. Identify the culprit Quality Rule causing the error by running the URI on the RestAPI interface 
  5. Apply the appropriate solution
  6. If you do not find the information you are looking for or solution for your problem, in this page, contact CAST Technical Support with Relevant input

Identify the error & the culprit URI in the Report generator log file 

This section will help you to identify and interpret an error from the report generator log file, as well as the URI from which the issue is occurred.

First step, open the report generator log file (Refer the page CAST Management Studio - Information - How to find logs to locate the log file).

This log file report all URI executed on RESTAPI as well as execution time. 

The following snippet of log illustrates one line of the log file:

2015-12-01 15:14:13,392 - DEBUG - Cast.Util.Log.LogHelper:
Request URL 'https://codi.qualitat.solucions.gencat.cat/CAST-RestAPI/rest/AD_LOTA08_02/applications
/4/snapshots' - Time elapsed : 00:00:00.0261866 

In case of unexpected results, this log file can help you to identify the URI from which the issue occurred.

In fact  in addition to the URI executed on RESTAPI and the execution time, the log file provides also the code error in case of issues. 

The following snippet of log indicate an error (see line after Time elapsed ):

2015-12-01 15:14:26,190 - DEBUG - Cast.Util.Log.LogHelper:
Request URL 'https://codi.qualitat.solucions.gencat.cat/CAST-RestAPI/rest/AD_LOTA08_02/applications
/4/snapshots/1/results?quality-indicators=nc:60011&select=violationRatio&modules=($all)' 
- Time elapsed : 00:00:00.1294804 
2015-12-01 15:14:26,203 - ERROR - Cast.Util.Log.LogHelper: 
An error occured during execution
System.Runtime.Serialization.SerializationException: There was an error deserializing the object 
of type System.Collections.Generic.IEnumerable`1[[CastReporting.Domain.Result, CastReporting.Domain, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. The value '1.578263' cannot be parsed 
as the type 'Int32'.
---> System.Xml.XmlException: The value '1.578263' cannot be parsed as the type 'Int32'. 
---> System.OverflowException: Value was either too large or too small for an Int32.
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Runtime.Serialization.Json.XmlJsonReader.ParseInt(String value, NumberStyles style)
   --- End of inner exception stack trace ---
   at System.Runtime.Serialization.Json.XmlJsonReader.ParseInt(String value, NumberStyles style)
   at System.Xml.XmlDictionaryReader.ReadElementContentAsInt()
   at ReadviolationRatioFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , 
XmlDictionaryString , XmlDictionaryString[] )
   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator 
jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadresultDetailFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson
 , XmlDictionaryString , XmlDictionaryString[] )
   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore
(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadapplicationResultFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson
 , XmlDictionaryString , XmlDictionaryString[] )
   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator 
jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(
XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadArrayOfapplicationResultFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson
 , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
   at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore
(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadresultFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson
 , XmlDictionaryString , XmlDictionaryString[] )
   at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)
   at ReadArrayOfresultFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson
 , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
   at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore
(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue
(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize
(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject
(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions
(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   --- End of inner exception stack trace ---
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions
(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
   at CastReporting.Repositories.CastRepository.CallWS[T](String relativeURL, RequestComplexity pComplexity)
   at CastReporting.BLL.SnapshotBLL.SetBusinessCriteriaNCRulesViolations()
   at CastReporting.BLL.SnapshotBLL.SetQualityIndicators()
   at System.Threading.Tasks.Task.Execute()

 How to interpret this snippet of log?

  • The first information that we can retrieve from this snippet of log, is that we have an execution error while executing the following URI:

    AD_LOTA08_02/applications/4/snapshots/1/results?quality-indicators=nc:60011&
    select=violationRatio&modules=($all)
  • The second information is the error in execution:
    For our example, and as you can see below, the error of execution is "The value '1.578263' cannot be parsed as the type 'Int32'". It means that the value '1.578263' cannot be an integer value.

    An error occured during execution System.Runtime.Serialization.SerializationException: There was an 
    error deserializing the object of type System.Collections.Generic.IEnumerable`1
    [[CastReporting.Domain.Result, CastReporting.Domain, Version=1.0.0.0, Culture=neutral, 
    PublicKeyToken=null]]. The value '1.578263' cannot be parsed as the type 'Int32'. 
    ---> System.Xml.XmlException:
    The value '1.578263' cannot be parsed as the type 'Int32'. ---> System.OverflowException: Value 
    was either too large or too small for an Int32. at System.Number.ParseInt32
    (String s, NumberStyles style, NumberFormatInfo info) 


Identify the culprit Quality Rule causing the error by running the URI on the RestAPI interface

After retrieving the URI from the log file, we do the following steps:

  1. Launch the Rest-API by using the URL on the browser
  2. Login by entering the username and password
  3. Paste the URI in the textbox HREF
  4. Click Submit

After proceeding to the RESTAPI page we search for the value identified in the error message, for example in the previous section we have identified the following error "The value '1.578263' cannot be parsed as the type 'Int32'".

In  the RESTAPI page, you can see that the value '1.578263' which was present in the error message is occurring for the Quality Measure "Complexity Volume (% of LoC)" bearing the ID - 7122.


Apply the appropriate solution 

CASE 1 - Inconsistency between the types of expected quality rule result and the value identified in the log file, this issue is not due to any corruption but an incorrect definition of the assessment model.

If the code error that you have find in the log file have the following form:

The value 'value' cannot be parsed as the type 'type'

 It means that there is inconstancy between the types of expected quality rule result and the type of the given quality rule result. In our example the quality rule

"Complexity Volume (% of LoC)" it's a cardinal, it cannot be a double value, It's normal to have an error that indicate that we are attending an integer value and not a double value.

The metric Complexity Volume (% of LoC) was returning incorrect values because it was associated with correct metric_group in the Knowledge Base but incorrect in the central base.

For resolving this issue follow the steps:

  1. From the RESTAPI, retrieve the metric id of the value presenting the error, for this follow steps of previous section: Identify the culprit Quality Rule causing the error by running the URI on the RestAPI interface
  2. Execute the below query on both Knowledge Base and Central base, where 'metric id' is the value retrieved from the RESTAPI.

    select metric_group from dss_metric_types where METRIC_ID = 'metric id'

    The result of the above query should return the same value on both Knowledge Base and Central base.

    For our example, the query will be:

    select metric_group from dss_metric_types where METRIC_ID = 7122

    The result of this query should return 15 on both Knowledge Base and central base.

    If the query on knowledge base return another value on the central base then you need to follow the below steps to resolve the problem.

     

  3. Update the value by running the below query on Central Base:

    UPDATE dss_metric_types set metric_group = 'result of the previous query on the knowledge base' where METRIC_ID = 'metric id'

     In our example the query will be:

    UPDATE dss_metric_types set metric_group = 15 where METRIC_ID = 7122
  4. Restart Tomcat.

  5. Relaunch the report generator and generate report.


CASE 2 : Total checks being less than the failed checks for any quality rule,  the root cause of the issue is - Button Snapshot "Consolidation" creates NULL results in central base.

The code error that you will find in the log file will have have the following form:

Value type 'type' cannot be null.  

 For example:

Runtime.Serialization.SerializationException: ValueType 'System.Int32' cannot be null.   at ReadviolationRatioFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] ) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
 

In this case the value for successful checks will be displayed as null for the culprit URI - AAD/applications/3/snapshots/2/results?quality-indicators=cc:60013&select=violationRatio&modules=($all)

The reason for the error is total checks being less than the failed checks for any quality rule. This issue occurs where the report generator crashes when the total checks < failed checks.

  1. Execute the below query to confirm that there are NULL values

    select count(*) from dss_metric_results mr
    where mr.metric_id in (
    select distinct r.metric_id
    from dss_metric_results r, dss_metric_types t
    where r.metric_value_index = 2
    and r.metric_num_value = 0
    and t.metric_id = r.metric_id
    and t.metric_group = 1)  ;


  2. If the above query returns value greater than 0 then execute the below query to remove NULL values:
    In our case the value is 12319 so execute the below query to remove NULL values

    delete from dss_metric_results mr
    where mr.metric_id in (
    select distinct r.metric_id
    from dss_metric_results r, dss_metric_types t
    where r.metric_value_index = 2
    and r.metric_num_value = 0
    and t.metric_id = r.metric_id
    and t.metric_group = 1)

  3. Re-generate the report


The delete statement clears out NULL values for only once, if you do a Consolidation, then the NULL values are inserted again. You need to again follow the 3 steps whenever you perform consolidation.

This Issue will be fixed in CastAIP 8.1.1

If you are still facing issue after applying the above solution then, identify the particular quality rule for which there is a problem with total and failed checks then contact  CAST Technical Support with relevant inputs mentioned in the page - CAST Engineering Dashboard - Quality rule - Incorrect Total Checks

Notes/comments

Tickets # 3906,4593, 5784

Related Pages