Ignition SDK Programmer's Guide
How-to Articles
Strategic Partner Links
Sepasoft - MES Modules
Cirrus Link - MQTT Modules
Resources
Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Examples
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.
The parameters to enable remote debugging are found in ignition.conf, under "{InstallDir}/data
". The parameters are already present, but commented out. To enable:
<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
Settings Notes: In the remote debug settings, there are two notable settings for the Xrunjdwp
command:
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.
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.
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.
<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>
<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
Under Run>Debug Configurations, create a new Java Application profile for your project. Set Main Class to: com.inductiveautomation.ignition.client.launch.BootstrapSwing
Set "Use classpath of module" to the client-launcher or designer-launcher module, depending on which one you are configuring.
Click on the "Arguments" tab. In the "VM arguments" section:
-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
-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.
4 Comments
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.
Anonymous
Works now. Thanks for updating all the Docs and the Component Example.
Anonymous
Step 2 under gateway scope with NetBeans:
debug->attach debugger
and enter port number.
Works for me.
Anonymous
Are there instructions for debugging with Netbeans in the Client and Designer scope available?