Application Debugging

In some cases, you might want to monitor the activity of the JVMClosed Java Virtual Machine. A virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. running as part of your .NET application. The jconsole is a great tool that allows you to troubleshoot the JVM internals.

Opening the JMX Port

The following is used to open the JMX port to view and monitor the JVM loaded into the .NET process memory address.

Have the following settings as part of your app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="GigaSpaces" type="GigaSpaces.Core.Configuration.GigaSpacesCoreConfiguration, GigaSpaces.Core"/>
  </configSections>
  <GigaSpaces>
    <JvmSettings>
      <JvmCustomOptions IgnoreUnrecognized="false">
        <add Option="-Dcom.sun.management.jmxremote.port=5144"/>
        <add Option="-Dcom.sun.management.jmxremote.ssl=false"/>
        <add Option="-Dcom.sun.management.jmxremote.authenticate=false"/>
      </JvmCustomOptions>
    </JvmSettings>
  </GigaSpaces>
</configuration>

See .NET JVM Configuration for more details.

Viewing in JConsole

  1. Start jconsole – jconsole is located under the bin directory of the Java home, by default it is under <Installation dir>\Runtime\java\bin

  2. Once the jconsole is started, select the Local tab:

    jcon1.jpg

  3. This shows the status of the JVM running in your .NET application:

    jcon2.jpg

For more details about JMX and jconsole, refer to: - Sun - Monitoring and Management Using JMX - Sun - Using jconsole.

Viewing in JVisualVM

As an alternative to viewing in JConsole, you can use JVisualVM.

  1. Start JVisualVM. The default location is the C:\GigaSpaces\XAP.NET-16.4-x64\Runtime\Java directory.

  2. Connect via JMX. Go to File | Add JMX Connection...

    jvisualvm-connect.png

  3. Enter the Connection: localhost:5144

  4. For thread dumps, go to the "Threads" tab, and click on the "Thread Dump" button.

    jvisualvm-thread1.png

    Or: Right click on the application in the left pane, and select "Thread Dump".

    jvisualvm-thread2.png

  5. Similarly for heap dumps, go to the "Monitor" tab, click on the "Heap Dump" button. Or right click on the application in the left pane and select "Heap Dump".