When configuring VM for replication the following error is seen after setup on Site Recovery Page - "Operation Failed Unable to connect to HBR Management Server at https://gti_VR_ip:8043. Reason: https://gt_VR_ip:8043 invocation failed with "java.net.ConnectException: Connection refused" Connection refused".
On viewing the VM's replication information the error - "The virtual machine is not configured for replication." is seen:
Other VMs are replicating fine with no issues, and new VMs can also be configured for replication.
VMware vSphere Replication 9.x
The VM facing this issue was previously configured for replication and was recently removed from it without retaining replica disks.
The removal of VM from replication was not performed properly, leaving behind a few files on the target datastore to which the VM was being replicated to.
The files are not the same as ones which would have been present if the "Retain replica disks" option was chosen during removal of VM from replication.
Due to these leftover files and the VM folder being present on the target datastore, the VM was unable to be configured for replication.
To ensure the VM is added for replication cleanly, perform the below:
Remove the VM from replication. (If it is present in the error-ed state.)
Verify that the VM is not seen in the outgoing/incoming replications on Site Recovery Page on both sites.
Go to the target datastore on the target vCenter and rename the VM's folder.
Then add the VM to replication and do not choose to add the seeds.
Alternatively, instead of step 3, in step 4 the VM can be replicated to another datastore.