Prerequisite
You are running the On Premises Contrast UI on a Windows platform.
Issue
A new application or server fails to onboard or a previously onboarded application has not been updated with new vulnerability instances.
The agent log contains errors similar to this one (example is from a .NET Framework sensor log):
2022-08-2413:17:15.1476WARN6252:9 ReportingClient Error communicating with Contrast for request URL:'/Contrast/api/ng/servers/'. [code:(500) InternalServerError]
2022-08-2413:17:15.1496ERROR6252:9 ServerStartReporter Server startup report for 'QAWEBSRV01' failed. Response: Failure (InternalServerError)
2022-08-2413:17:15.1496ERROR6252:1 SensorsInitializer Application will not be analyzed because server start report failed.
The Contrast UI log at C:\Program Files\contrast\data\logs\contrast.log
contains a corresponding entry similar to the following:
240822 06.47.52,051 {214590acf281} {agent_a7f5656-897c-45df-8d31-7f17fda30b7e@MyOrg} {} ERROR (ServerUpdateHandler.java:32) [UPDATE SERVER] java.lang.IllegalStateException: Not a JSON Object: "" -> Report 697020c5-9516-4ea8-b288-214590acf281 (485 bytes, app=[null,.NET 50.0.21.0]) from [10.100.3.198]:49779 received at Wed Aug 24 06:47:51 EDT 2022, type: ServerUpdate, server=DEVWEBSRV01,C:\Windows\system32\inetsrv\w3wp.exe,iis10, uid: agent_a7c54835-897c-45df-8d31-7f17fda30b7e@MyOrg, compressed: true, hash: null, contentType=application/json
240822 06.47.52,113 {} {} {} ERROR (JmsMessageErrorHandler.java:14) [JMS Error] Not a JSON Object: "?"
java.lang.IllegalStateException: Not a JSON Object: "?"
Cause
The default encoding on Windows is GBK but is UTF-8 on Linux. The Contrast UI expects UTF-8, and when installed using the embedded installer Contrast includes the following JVM option in C:\Program Files\contrast\bin\contrast-server.vmoptions
:
-Dfile.encoding=utf-8
If this option is missing or it has not been added when hosting the Contrast UI on your own Tomcat Server, the default Windows encoding will be assumed, causing the UTF-8 BOM character to be rejected.
Resolution
Ensure that UTF-8 encoding is enabled as detailed in the Cause above.