In the *-service.xml file that defines your mbean you need to add a depends clause that references the connection factory mbean for the data source you are interested in.
Actually I tried the dependency earlier, but in my case the exception related to ConnectionFactory was getting thrown from some other bean. I made changes such that
ConnectionFactory depends on CustomBean for DB check
IssueBean depends on ConnectionFactory
and it is working fine now.
Thanks Peter for your guidance.