Currntly i'm trying to use the persepective-component example to create a component in an existing ignition module. I coppied over the code from example and then found the mavern equivalent dependines since the example is based on Gradle. My dev environment matches the versuins listed below. I've also added the code snippet where the error is thrown.
java.lang.NoClassDefFoundError: com/inductiveautomation/perspective/gateway/api/PerspectiveContext
at ami.GatewayHook.startup(GatewayHook.java:63)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.startup(ModuleManagerImpl.java:2439)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1232)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:777)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:953)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:743)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1909)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1862)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:47)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:1030)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:1098)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:544)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.perspective.gateway.api.PerspectiveContext
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:37)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader.loadClass(ModuleClassLoader.java:85)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
Code Snippet
@Override
public void startup(LicenseState licenseState) {
this.perspectiveContext = PerspectiveContext.get(this.gatewayContext); //LINE 63: Error is Thrown
this.componentRegistry = this.perspectiveContext.getComponentRegistry();
this.modelDelegateRegistry = this.perspectiveContext.getComponentModelDelegateRegistry();
if (this.componentRegistry != null) {
log.info("Registering Rad components.");
this.componentRegistry.registerComponent(Image.DESCRIPTOR);
this.componentRegistry.registerComponent(TagCounter.DESCRIPTOR);
this.componentRegistry.registerComponent(Messenger.DESCRIPTOR);
} else {
log.error("Reference to component registry not found, Rad Components will fail to function!");
}
if (this.modelDelegateRegistry != null) {
log.info("Registering model delegates.");
this.modelDelegateRegistry.register(Messenger.COMPONENT_ID, MessageComponentModelDelegate::new);
} else {
log.error("ModelDelegateRegistry was not found!");
}
}
Yeah, it's missing a <depends> section that declares a dependency on the Perspective module, similar to this one used in the device example declaring a dependency on the OPC UA module.