Not able to remotely connect from Visual VM












1















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










share|improve this question



























    1















    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










    share|improve this question

























      1












      1








      1








      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










      share|improve this question














      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







      cloudfoundry visualvm






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 28 '18 at 17:03









      sauravsaurav

      1,98172652




      1,98172652
























          2 Answers
          2






          active

          oldest

          votes


















          1














          JMX needed to be enabled in the container by using this command and that enabled JMX connection from visualvm



          cf set-env myapp JBP_CONFIG_JMX '{ enabled: true }'






          share|improve this answer

































            -1














            Looks like the SSH tunneling is not working for you.



            First thing you might want to try is the ssh into the application container using cf ssh <application_name>



            Once you are in the container run netstat -lntu to find the debugging port 8000 is open or not. If its open then,exit the ssh console, tunnel to the application using cf ssh -N -T -L <LOCAL_PORT>:localhost:<REMOTE_PORT> <APPLICATION_NAME>, and try connecting back to localhost:8000



            If the debugging port is not open then set the JBP_CONFIG_DEBUG '{enabled: true}' variable and restart the application.



            Also the default debug port is 8000 and not 5000 so if you want to connect to port 5000 your ssh command should be cf ssh -N -T -L 5000:localhost:8000<APPLICATION_NAME>






            share|improve this answer
























            • thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

              – saurav
              Nov 28 '18 at 17:22











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53524609%2fnot-able-to-remotely-connect-from-visual-vm%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            JMX needed to be enabled in the container by using this command and that enabled JMX connection from visualvm



            cf set-env myapp JBP_CONFIG_JMX '{ enabled: true }'






            share|improve this answer






























              1














              JMX needed to be enabled in the container by using this command and that enabled JMX connection from visualvm



              cf set-env myapp JBP_CONFIG_JMX '{ enabled: true }'






              share|improve this answer




























                1












                1








                1







                JMX needed to be enabled in the container by using this command and that enabled JMX connection from visualvm



                cf set-env myapp JBP_CONFIG_JMX '{ enabled: true }'






                share|improve this answer















                JMX needed to be enabled in the container by using this command and that enabled JMX connection from visualvm



                cf set-env myapp JBP_CONFIG_JMX '{ enabled: true }'







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 4 '18 at 3:34









                Shiva

                5,09632751




                5,09632751










                answered Nov 29 '18 at 14:07









                sauravsaurav

                1,98172652




                1,98172652

























                    -1














                    Looks like the SSH tunneling is not working for you.



                    First thing you might want to try is the ssh into the application container using cf ssh <application_name>



                    Once you are in the container run netstat -lntu to find the debugging port 8000 is open or not. If its open then,exit the ssh console, tunnel to the application using cf ssh -N -T -L <LOCAL_PORT>:localhost:<REMOTE_PORT> <APPLICATION_NAME>, and try connecting back to localhost:8000



                    If the debugging port is not open then set the JBP_CONFIG_DEBUG '{enabled: true}' variable and restart the application.



                    Also the default debug port is 8000 and not 5000 so if you want to connect to port 5000 your ssh command should be cf ssh -N -T -L 5000:localhost:8000<APPLICATION_NAME>






                    share|improve this answer
























                    • thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                      – saurav
                      Nov 28 '18 at 17:22
















                    -1














                    Looks like the SSH tunneling is not working for you.



                    First thing you might want to try is the ssh into the application container using cf ssh <application_name>



                    Once you are in the container run netstat -lntu to find the debugging port 8000 is open or not. If its open then,exit the ssh console, tunnel to the application using cf ssh -N -T -L <LOCAL_PORT>:localhost:<REMOTE_PORT> <APPLICATION_NAME>, and try connecting back to localhost:8000



                    If the debugging port is not open then set the JBP_CONFIG_DEBUG '{enabled: true}' variable and restart the application.



                    Also the default debug port is 8000 and not 5000 so if you want to connect to port 5000 your ssh command should be cf ssh -N -T -L 5000:localhost:8000<APPLICATION_NAME>






                    share|improve this answer
























                    • thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                      – saurav
                      Nov 28 '18 at 17:22














                    -1












                    -1








                    -1







                    Looks like the SSH tunneling is not working for you.



                    First thing you might want to try is the ssh into the application container using cf ssh <application_name>



                    Once you are in the container run netstat -lntu to find the debugging port 8000 is open or not. If its open then,exit the ssh console, tunnel to the application using cf ssh -N -T -L <LOCAL_PORT>:localhost:<REMOTE_PORT> <APPLICATION_NAME>, and try connecting back to localhost:8000



                    If the debugging port is not open then set the JBP_CONFIG_DEBUG '{enabled: true}' variable and restart the application.



                    Also the default debug port is 8000 and not 5000 so if you want to connect to port 5000 your ssh command should be cf ssh -N -T -L 5000:localhost:8000<APPLICATION_NAME>






                    share|improve this answer













                    Looks like the SSH tunneling is not working for you.



                    First thing you might want to try is the ssh into the application container using cf ssh <application_name>



                    Once you are in the container run netstat -lntu to find the debugging port 8000 is open or not. If its open then,exit the ssh console, tunnel to the application using cf ssh -N -T -L <LOCAL_PORT>:localhost:<REMOTE_PORT> <APPLICATION_NAME>, and try connecting back to localhost:8000



                    If the debugging port is not open then set the JBP_CONFIG_DEBUG '{enabled: true}' variable and restart the application.



                    Also the default debug port is 8000 and not 5000 so if you want to connect to port 5000 your ssh command should be cf ssh -N -T -L 5000:localhost:8000<APPLICATION_NAME>







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 28 '18 at 17:16









                    ShivaShiva

                    5,09632751




                    5,09632751













                    • thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                      – saurav
                      Nov 28 '18 at 17:22



















                    • thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                      – saurav
                      Nov 28 '18 at 17:22

















                    thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                    – saurav
                    Nov 28 '18 at 17:22





                    thanks Shiva for the reply..i checked that remote port is opened and followed the steps mentioned by you...but getting the same error

                    – saurav
                    Nov 28 '18 at 17:22


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53524609%2fnot-able-to-remotely-connect-from-visual-vm%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)