Ruk-Com PaaS Documentation

Build, deploy and operate applications on the platform.

RUK-COM PAAS / APPLICATION SETTINGS

Remote Debugging

This guide is maintained for Ruk-Com PaaS. Screens and options may vary by platform version and account permissions.

Confirm the environment, region and account permissions, and back up current settings before changing a production system.

With Public IPs in the platform, you can use remote debugging. Now you can debug your application running on the platform by connecting it with code in your IDE. First of all, let’s consider the basic aspects of remote debugging.

How does remote debugging work?

Java provides this feature using listener binding mechanism. Basic concept is pretty easy and elementary:

  • Application to be debugged would attach a socket to itself and then would listen debug instructions on that socket.
  • Debugger would bind itself to that socket and then send instructions on that socket.

Create Environment

  1. Log into the platform dashboard.

  2. Click Create environment to set up a new environment.

Image 46: create environment 3. Choose the instances you want to use (for example, Tomcat application server), set the cloudlets limit and switch on external IP. Then type the name of environment and click Create.

Image 47: environment wizard In a minute the environment will be created.

  1. Expand the list of environment and use Additionally button for your instance to see the number of your Public IP.

Image 48: public IP

Deploy an Application

  1. Upload your Java package to the Deployment manager.

Image 50: upload archive 2. Once the package is in the platform, deploy it to the environment you have just created.

Image 51: deploy application As an example we use simple application, which initializes three variables (a, b, c) in turn.

java Copy

package com;
public class RemoteDebugger {

   public void start () {
       int a,b,c;
       a = 1;
       System.out.println("a = "+ a);
       b = 2;
       System.out.println("b = "+ b);
       c = 3;
       System.out.println("c = "+ c);
       }
}

Configure Debugging

  1. Open the application in your IDE (e.g., NetBeans) and create a new debugger (Debug main project > Attach Debugger).

Image 53: NetBeans attach debugger 2. Select the type of connector, insert your Public IP address (host), the number of the port, you would like to listen to and specify timeout settings (optional).

Image 54: NetBeans debugger connection 3. Switch back to the platform dashboard and click the Config button for Tomcat.

Image 55: Tomcat config 4. Navigate to variables.conf file and supply two arguments, -Xdebug and -Xrunjdwp.

-Xdebug tells JVM to run the application in debug mode, while -Xrunjdwp is used to supply debug parameters.

Copy

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000

Image 56: configure Tomcat variables

Note: The port number in variables.conf and in your debugger should be the same.

  1. Save the changes and restart Tomcat.

  2. Put the break point to your code to test remote debugging and start the newly created debugger. In our case the application should initialize only two variables instead of three.

Image 57: NetBeans code break point Let’s check Tomcat logs to ensure that debugging works properly.

Image 58: Tomcat logs before break point As you see everything is ok, two variables have been initialized.

  1. If we put the break point one row down, three variables will be initialized by our app.

Image 59: NetBeans break point next lineImage 60: Tomcat logs after break point

Tip: The instruction above is fully suitable for Jetty application server.

In case you use GlassFish as your application server you have to supply -Xdebug and -Xrunjdwp arguments via the admin panel page.

  • When you created the environment, the platform sent you an email with credentials to the GlassFish Admin Console. Log in with these credentials.

Image 61: GlassFish admin console * Navigate to gfcluster-config > JVM Settings and select the General tab > Debug options. Specify your debug mode and debug parameters.

Image 62: GlassFish debug options * Go to JVM options and add two arguments: -Xdebug and -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000.

Image 63: GlassFish JVM settings * Save all changes and restart GlassFish.

Hope this instruction will be useful for you.