Skip to end of metadata
Go to start of metadata

Being able to debug your code on the fly using your IDE is crucial to effectively developing modules. Since your module is running inside of Ignition, a few extra steps need to be taken to set things up.

 

Gateway Scope

To debug your gateway based code, you'll use Java remote debugging to connect IntelliJ to the running Ignition instance. Ignition will be running your module, so you must have the most recent code deployed, but you will then be able to set breakpoints, examine variable values, etc.

Step 1 - Enable Remote Debugging in Ignition

The parameters to enable remote debugging are found in ignition.conf, under "{InstallDir}/data". The parameters are already present, but commented out. To enable:

  1. Stop the Ignition service
  2. Edit <InstallDir>/data/ignition.conf Remove the comment for the lines:
     
    wrapper.java.additional.8=-Xdebug
    wrapper.java.additional.9=-Xrunjdwp:transport=dt_socket,server=y,suspend=n, address=*:8000
     
  3. Restart the Ignition service.


Settings Notes: In the remote debug settings, there are two notable settings for the Xrunjdwp command:

  • address -  The port the that the debugger will attach from. Depending on the applications running on your machine, you may need to change this to find an unused port. 
  • suspend - Denotes whether the Ignition service will block and wait for a remote debug session to become established. Setting to "y",causes Ignition to block on startup until the remote debug session is established, which is useful for debugging module startup. However, remember to this back to "n" when finished debugging, or the Ignition service will be blocked on startup when starting without a remote debug session. 


Step 2 - Create a Remote Debug Profile in IntellJ

Under Run>Edit Configurations, create a new "Remote" configuration. This profile will debug the project select under the "Project" setting, so make sure that the current selection is correct. Also, if you changed the port in the config file, make sure to set it here as well. 
 

To debug, simply run this configuration. Note that you may need to allow the applications (both Ignition and IntelliJ) to access the network/bypass the firewall, depending on your operating system setup.

Client Scope

To debug client based code, such as components, you'll need to create an IntelliJ Launch Configuration that launches an Ignition client, bypassing Java Web Start.
Note: You can debug either the designer or a client. If using a client, you'll need to first create a project that uses your component, so that you can specify the project name later in the config.

Step 0 - Create Client and Designer "Launcher" Maven Modules

Add two new Maven modules to your project. These modules are just placeholders that collect the dependencies needed to launch an Ignition client or designer in one place. Then, when setting up the application launcher profiles in later steps, you will just set the classpath to either the client or designer maven module.

client-launcher/pom.xml
client-launcher/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>${your-parent-groupid}</groupId>
        <artifactId>${your-parent-artifactid}</artifactId>
        <version>${your-parent-version}</version>
    </parent>

    <artifactId>client-launcher</artifactId>
    <packaging>pom</packaging>

    <dependencies>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>client-api</artifactId>
            <version>7.8.3</version>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>vision-client-api</artifactId>
            <version>7.8.3</version>
        </dependency>
        
        <!-- your client-scoped dependency or dependencies go here -->
    </dependencies>
</project>

 

designer-launcher/pom.xml
designer-launcher/pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>${your-parent-groupid}</groupId>
        <artifactId>${your-parent-artifactid}</artifactId>
        <version>${your-parent-version}</version>
    </parent>

    <artifactId>designer-launcher</artifactId>
    <packaging>pom</packaging>

    <dependencies>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>designer-api</artifactId>
            <version>7.8.3</version>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>vision-designer-api</artifactId>
            <version>7.8.3</version>
        </dependency>
        <!-- your designer-scoped dependency or dependencies go here -->
    </dependencies>
</project>

 

 

See the vision-component example on Github for reference: https://github.com/inductiveautomation/ignition-sdk-examples/tree/master/vision-component

Step 1 - Create a new Java Application Launch Profile

Under Run>Debug Configurations, create a new Java Application profile for your project. Set Main Class to: com.inductiveautomation.ignition.client.launch.BootstrapSwing

Step 2 - Set up the Classpath

Set "Use classpath of module" to the client-launcher or designer-launcher module, depending on which one you are configuring.

Step 3 - Set up VM arguments

Click on the "Arguments" tab. In the "VM arguments" section:

For Debugging in the Designer:

-Dscadarail.version=dev

-Djavaws.sr.gateway.addr.0=127.0.01:8088:8043/main

-Djavaws.sr.scope=D

-Djavaws.sr.main=com.inductiveautomation.ignition.designer.DesignerStartupHook

 

For Debugging in the Client:

-Dscadarail.version=dev

-Djavaws.sr.gateway.addr.0=127.0.01:8088:8043/main

-Djavaws.sr.scope=C

-Djavaws.sr.main=com.inductiveautomation.factorypmi.application.runtime.ClientLaunchHook

-Djavaws.sr.project=ProjectName -Djavaws.sr.project.scope=Published

 


Remember: Set the last parameter, "project", to your correct project name. This parameter is case-sensitive.


When you run this config profile, the client or designer will be launched, and the project you specified under the "Main" tab will be debuggable.

  • No labels

4 Comments

  1. Anonymous

    These instructions do not work for IntelliJ 2016 Ultimate

    Error: Could not find or load main class com.inductiveautomation.ignition.client.launch.BootstrapSwing.

     

    Can Inductive Automation correct this.  Sure would be great to Remote Debug Modules.

  2. Anonymous

    Works now.  Thanks for updating all the Docs and the Component Example.

  3. Anonymous

    Step 2 under gateway scope with NetBeans:

    debug->attach debugger

    and enter port number.

    Works for me. 

  4. Anonymous

    Are there instructions for debugging with Netbeans in the Client and Designer scope available?