EM12C: Mismatch hostname certificate

1. Check the status of agent, if you see below error.

[oracle@******* bin]$ ./emctl status agent

Oracle Enterprise Manager 12c Cloud Control 12.1.0.1.0
Copyright (c) 1996, 2012 Oracle Corporation. All rights reserved.
—————————————————————
Status agent Failure:unable to connect to http server at https://******:3872/emd/lifecycle/main/. [failed to match hostname *******  with certificate DN CN=******]
Agent is Not Running

Solution :-

1. check the emctl.log and *nohup / *trc
2. address already in use errors
3. check the port is used or not.

[oracle@******* ~]$ netstat -an|grep 3872
tcp 0 0 0.0.0.0:3872 0.0.0.0:* LISTEN

[root@******** ~]# /usr/sbin/lsof -i :3872

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 5798 oracle 58u IPv4 16697 TCP *:oem-agent (LISTEN)

4. kill the process used by that port.
kill -9 5798