ERROR c.v.h.s.remote.task.RemoteTaskSync- Unable to send remote tasks for location 20200304090132532-7c4fe304-7790-4f4d-9867-d521fafce26a. Error Error at index 3 in: "643Z" java.lang.NumberFormatException: Error at index 3 in: "643Z" at java.base/java.lang.NumberFormatException.forCharSequence(Unknown Source) at java.base/java.lang.Integer.parseInt(Unknown Source) at java.sql/java.sql.Timestamp.valueOf(Unknown Source) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getInstantFromString(RemoteTaskSync.java:198) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getLastSyncTime(RemoteTaskSync.java:190) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.getDataToSend(RemoteTaskSync.java:108) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.sendData(RemoteTaskSync.java:90) at com.vmware.hybridity.service.remote.task.RemoteTaskSync.run(RemoteTaskSync.java:62) at com.vmware.vchs.hybridity.messaging.LoggingJobWrapper.run(LoggingJobWrapper.java:41) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
This issue can be resolved by following the steps listed below:
1. Login to TCA-CP shell
PGPASSWORD=$(cat /common/pgsql/passwords/tca_admin) psql -U tca_admin -d tca
3. Execute the following command on the PostgreSQL console:
DROP FUNCTION IF EXISTS
"remoteTask_getSyncStatus"
;
CREATE FUNCTION
"remoteTask_getSyncStatus"
(given jsonb) RETURNS json AS $$
DECLARE
res json;
BEGIN
SELECT COALESCE(json_agg(json_strip_nulls(to_json(t)->
'val'
)) FILTER (WHERE is_json_object_not_empty(to_json(t)->
'val'
)),
'[]'
::json) INTO res
FROM(
SELECT
CASE
WHEN (to_jsonb(level1)->
'val'
?
'lastSyncTime'
)
THEN jsonb_set(to_jsonb(level1),
'{val, lastSyncTime}'
, to_jsonb(RTRIM(to_jsonb(level1)->
'val'
->>
'lastSyncTime'
,
'Z'
)))->
'val'
ELSE to_jsonb(level1)->
'val'
END as val
FROM (
SELECT val
FROM
"RemoteTaskStatus"
WHERE ( ( NOT( given ?
'location'
) or val->>
'location'
= given->>
'location'
) and ( NOT( given ?
'status'
) or val->>
'status'
= given->>
'status'
) )
) as level1
) AS t;
RETURN res;
END;
$$
LANGUAGE plpgsql;