Unable to load hook class

Hello

I have created a simple designer scoped module called ‘HelloWorld’. It contains one method that returns ‘hello world’. Simple as that, just for a first step in module development. It follows a very simple project structure (i.e. no separate build folder) to cut down troubleshooting.

I have used a maven ‘quickstart’ template in eclipse to create the project then copied the relevant ignition dependencies etc into the pom file. It compiles and builds without error. I have signed the resultant modl and imported it into the gateway.

However it has the status of ‘faulted’ in red, not the glorious green ‘running’ status that I had hoped for. The error is below which indicates I have something wrong with the hook path… but the hook path seems fine to me. What am I missing here?

Attached is the modl below.

helloworld-signed.modl (2.4 KB)

com.inductiveautomation.ignition.common.modules.ModuleLoadException: Unable to load hook class “com.example.simple.helloworld.ExampleDesignerHook” for module “com.example.simple.helloworld”.
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2159)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.load(ModuleManagerImpl.java:1849)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1051)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:648)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:801)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:624)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.access$900(ModuleManagerImpl.java:134)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1722)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1659)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:45)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:739)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:760)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:546)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.example.simple.helloworld.ExampleDesignerHook
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2138)
… 19 more

7.9.3 (b2017060210)
Oracle Corporation 1.8.0_144

Hmm, I opened the modl and cannot find the jar file in there. What could cause this?

Attached below is the project.

helloworld.zip (27.6 KB)

A minimal project using the ignition maven plugin should have two maven modules: one for the build, and one for the code.

Ok.

Well I have now changed the code to have a both a build and code module (attached). Now I can see the jar within the modl. However still the error persists when loaded into the gateway. Quite frustrating that a simple ‘hello world’ is taking so long to get going… Can you give me some pointers? Attached is the very simple project.

HelloWorldExample.zip (32.2 KB)

com.inductiveautomation.ignition.common.modules.ModuleLoadException: Unable to load hook class “com.testing.examples.stp.ExampleModuleHook” for module “com.testing.examples.simplehelloworld”.
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2159)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.load(ModuleManagerImpl.java:1849)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1051)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:648)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:801)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:624)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.access$900(ModuleManagerImpl.java:134)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1722)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1659)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:45)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:739)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:760)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:546)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/inductiveautomation/ignition/designer/model/AbstractDesignerModuleHook
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2138)
… 19 more
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.ignition.designer.model.AbstractDesignerModuleHook
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 31 more

7.9.3 (b2017060210)
Oracle Corporation 1.8.0_144

In your ignition-maven-plugin configuration you’ve got the project and hook specified as being gateway scoped.

Thanks Kevin.

That worked, silly error on my part. Changed the scope to ‘D’ and it is now running.