Error Loading Gateway Hook: Registering New DataSource

I’m trying to register a new datasource in my GatewayHook class, but it faults every time the module is installed to the gateway. I have included “reporting-gateway” as a dependency for the gateway scope. Of course, it works just fine in the sdk reporting example. I don’t know what is different about my configuration.

This is my startup function in the GatewayHook.

[code] public void startup(LicenseState licenseState) {
GatewayDataSourceRegistry.get(context).register(new AlarmBenchmarkDatasource());

}[/code]

This error appears in console log every time the module is installed.

[code] Error loading hook classes for module “module”.

com.inductiveautomation.ignition.common.modules.ModuleLoadException: Unable to load hook class “com.module.gateway.GatewayHook” for module “module”.
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2238)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.load(ModuleManagerImpl.java:2019)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1492)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$4.call(ModuleManagerImpl.java:982)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:1124)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:962)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.access$1500(ModuleManagerImpl.java:124)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1889)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1826)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:45)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:738)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:759)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:537)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: com/inductiveautomation/reporting/gateway/api/ReportDataSource
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.loadHook(ModuleManagerImpl.java:2212)
… 19 more
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.reporting.gateway.api.ReportDataSource
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 24 more[/code]

Anyone know what I am missing?

In addition to the dependency on the reporting-gateway jar, you need to indicate that your module depends on the reporting module as well.

Something like this in your module configuration:

<depends>
	<depend>
		<scope>G</scope>
		<moduleId>rept</moduleId>
	</depend>
</depends>

Oops. Thanks, Kevin.

Speaking of module dependencies, can the Gateway scope be made to still function without the reporting module installed (minus reporting capabilities of course) ? Because in this instance the gateway scope is doing other non-reporting things.

That’s not possible right now, unfortunately. Moving your reporting-related code into its own module would probably be the best way to go if you didn’t want to rely on the reporting module being present.