Trying to compile and run the HelloWorld demo

I’ve run into a problem trying to run the “hello world” example in the SDK. I successfully compile the example in Netbeans and create the .modl file. However, when I install the new module into ignition and try to run the designer I get the following on the JAVA console log and the designer application hangs. Looks like the class [color=#BF4000]com/inductiveautomation/ignition/examples/ce/components/HelloWorldComponent[/color] didn’t make it into the module correctly.

09:56:53.649 [Designer-Startup] INFO designer.main - Starting module: Symbol Factory [+8462] 09:56:53.671 [Designer-Startup] INFO designer.main - Starting module: ComponentExample [+8484] Exception in thread "Designer-Startup" java.lang.NoClassDefFoundError: com/inductiveautomation/ignition/examples/ce/components/HelloWorldComponent at com.inductiveautomation.ignition.examples.ce.MyModuleDesignerHook.startup(MyModuleDesignerHook.java:36) at com.inductiveautomation.ignition.designer.IgnitionDesigner$LoadedModule.startup(IgnitionDesigner.java:1746) at com.inductiveautomation.ignition.designer.IgnitionDesigner.startupModule(IgnitionDesigner.java:961) at com.inductiveautomation.ignition.designer.IgnitionDesigner.loadProject(IgnitionDesigner.java:839) at com.inductiveautomation.ignition.designer.IgnitionDesigner$StartupProjectDialogHandler$1.run(IgnitionDesigner.java:1818) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.ignition.examples.ce.components.HelloWorldComponent at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more 09:56:53.711 [SQLTags-TreeLoader-1] INFO ignition.TagManager.Gateway - Starting tag polling.

Looking thro’ the build log on my NetBeans IDE, I see the following:

[code]— maven-jar-plugin:2.3.2:jar (default-jar) @ ce-build —
JAR will be empty - no content was marked for inclusion!
Building jar: …/ignition-sdk-examples/ComponentExample/ce-build/target/ce-build-1.8.0.jar

**** I’ve deleted a number of lines here *****

Reactor Summary:

component-example … SUCCESS [0.480s]
ce-client … SUCCESS [7.314s]
ce-designer … SUCCESS [1.283s]
ce-build … SUCCESS [1.217s]
client-launcher … SUCCESS [0.016s]
designer-launcher … SUCCESS [0.013s]

BUILD SUCCESS

Total time: 10.537s
Finished at: Sat Jan 14 10:19:08 EST 2017
Final Memory: 27M/257M
------------------------------------------------------------------------[/code]

Now, Phil Lynott has assured me on many occasions that “There’s whiskey in the Jar”, so I am a little disappointed.

Any ideas on how to fix would be most appreciated.

Jim

You can inspect the contents of the modl file that gets built to make sure the jar files and classes inside the jar files are present (or verify they are not).

Jars and modl files are both just zip files.

I unzipped the .modl file. It gave me three files.

The first is module.xml:

<?xml version="1.0" encoding="UTF-8"?> <modules> <module> <id>com.inductiveautomation.ignition.examples.ce</id> <name>ComponentExample</name> <description>A module that adds a simple component to the Vision module.</description> <version>1.8.0</version> <requiredignitionversion>7.7.0</requiredignitionversion> <requiredframeworkversion>6</requiredframeworkversion> <depends scope="D">fpmi</depends> <jar scope="C">ce-client-1.8.0.jar.pack.gz</jar> <jar scope="D">ce-designer-1.8.0.jar.pack.gz</jar> <hook scope="D">com.inductiveautomation.ignition.examples.ce.MyModuleDesignerHook</hook> </module> </modules>

A second is “ce-designer-1.8.0.jar.pack.gz” which when unpacked gives me:

iMac:test2 jimkelly$ unpack200 ../ce-designer-1.8.0.jar.pack.gz designer.jar
iMac:test2 jimkelly$ unzip designer.jar
Archive:  designer.jar
PACK200
  inflating: META-INF/MANIFEST.MF    
  inflating: images/hello_world_16.png  
  inflating: images/hello_world_32.png  
  inflating: META-INF/maven/com.inductiveautomation.ignition.examples/ce-designer/pom.properties  
  inflating: META-INF/maven/com.inductiveautomation.ignition.examples/ce-designer/pom.xml  
  inflating: com/inductiveautomation/ignition/examples/ce/MyModuleDesignerHook.class  
  inflating: com/inductiveautomation/ignition/examples/ce/beaninfos/HelloWorldComponentBeanInfo.class  
  inflating: com/inductiveautomation/ignition/examples/ce/beaninfos/HelloWorldComponentTermFinder.class

A third “ce-client-1.8.0.jar.pack.gz” which when unpacked gives me:

iMac:test jimkelly$ unpack200 ../ce-client-1.8.0.jar.pack.gz client.jar
iMac:test jimkelly$ unzip client.jar
Archive:  client.jar
PACK200
  inflating: META-INF/MANIFEST.MF    
  inflating: META-INF/maven/com.inductiveautomation.ignition.examples/ce-client/pom.properties  
  inflating: META-INF/maven/com.inductiveautomation.ignition.examples/ce-client/pom.xml  
  inflating: com/inductiveautomation/ignition/examples/ce/components/ChartComponent.class  
  inflating: com/inductiveautomation/ignition/examples/ce/components/HelloWorldComponent.class  
  inflating: com/inductiveautomation/ignition/examples/ce/components/HelloWorldComponent$1.class  

My un-informed brain tells me that what is needed is there. Obviously, I’m missing something. Does the example need to be updated to allow it to run on ignition 7.9?

Did you modify the build pom at all? ce-client.jar should be “CD” scope, not just “C”.

The ce-build POM has the following segment.

                    <projectScopes>
                        <projectScope>
                            <name>ce-designer</name>
                            <scope>D</scope>
                        </projectScope>

                        <projectScope>
                            <name>ce-client</name>
                            <scope>CD</scope>
                        </projectScope>
                    </projectScopes>

In the ce-client POM, the scope is listed as “provided”.
I’ll try editing the unpacked module.xml file and repack it and see if it works.

Ok, editing the module.xml file and correcting the scope for ce-client allows me to create a .modl file that works. :smiley:

How do I correct my maven setup so that the module.xml file is created with the appropriate scope in the first place?

It might be a bug in the older version of the ignition-maven-plugin that the component example (and probably the others too?) are using. The latest version is 1.0.12 - try changing it to that and running ‘mvn clean build’ to build the module.

It could be that I don’t have the ignition-maven-plugin installed at all.

Hope you didn’t get the impression that I knew what I was doing :smiley:

The ignition-maven-plugin isn’t something you need to install, it’s a Maven plugin referenced in each of the build project pom files.

Change:

    <build>
        <plugins>
            <plugin>
                <groupId>com.inductiveautomation.ignitionsdk</groupId>
                <artifactId>ignition-maven-plugin</artifactId>
                <version>1.0.5</version>

to:

    <build>
        <plugins>
            <plugin>
                <groupId>com.inductiveautomation.ignitionsdk</groupId>
                <artifactId>ignition-maven-plugin</artifactId>
                <version>1.0.12</version>

Just had it compiled with the change you suggested, when I saw your note Kevin. Works like a charm. Thanks. :smiley: