# Error Loading Gateway Hook: Registering New DataSource

**URL:** <https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158>\
**Category:** 3rd Party Modules\
**Created:** [February 1, 2016, 11:08pm UTC](https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158 "2016-02-01T23:08:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssmith](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@ssmith](https://forum.inductiveautomation.com/u/ssmith)\
**Post date:** [February 1, 2016, 11:08pm UTC](https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158/1 "2016-02-01T23:08:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 2, 2016, 12:02am UTC](https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158/2 "2016-02-02T00:02:14Z")

</div>

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:

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

---

<div class="post-metadata">

**Author:** ![ssmith](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@ssmith](https://forum.inductiveautomation.com/u/ssmith)\
**Post date:** [February 2, 2016, 2:44pm UTC](https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158/3 "2016-02-02T14:44:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 2, 2016, 3:16pm UTC](https://forum.inductiveautomation.com/t/error-loading-gateway-hook-registering-new-datasource/11158/4 "2016-02-02T15:16:13Z")

</div>

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.
