I have one application deployed in one of the CF cloud providers.

My application is on <https://github.com/cloudfoundry/java-buildpack.git#v4.6>

I am following this post to connect visual vm to the java app
<https://fabianlee.org/2017/12/09/cloudfoundry-enabling-java-jmx-rmi-access-for-remote-containers/>

I enabled the JMX connection.

But when i add the JMX connection in visual vm as localhost:5000

I get "Cannot connect to localhost:5000 using service:jmx:rmi:///jndi/rmi://localhost:5000/jmxrmi"

I have also tried enabling remote debugging in my application through JDWP option and connecting as a remote host in visual vm but that also results " cannot connect" error.

Am i missing anything here ?

Has anyone connected memory profilers to cf containers ?

Best Regards,
Saurav