# GatewayException class def not found

**URL:** <https://forum.inductiveautomation.com/t/gatewayexception-class-def-not-found/38103>\
**Category:** Module Development\
**Tags:** database, ignition79\
**Created:** [August 26, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/gatewayexception-class-def-not-found/38103 "2020-08-26T17:47:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliot.lohr](https://avatars.discourse-cdn.com/v4/letter/e/3bc359/32.png) [@elliot.lohr](https://forum.inductiveautomation.com/u/elliot.lohr)\
**Post date:** [August 26, 2020, 5:47pm UTC](https://forum.inductiveautomation.com/t/gatewayexception-class-def-not-found/38103/1 "2020-08-26T17:47:07Z")

</div>

Hey all, I’m trying to develop a module that can query a db connection. I’m trying to test my query to the DB and am receiving an error on a gateway exception saying it can’t find the class def.

Here is my code:

```auto

import com.inductiveautomation.ignition.client.gateway_interface.GatewayConnectionManager;
import com.inductiveautomation.ignition.client.gateway_interface.GatewayException;
import com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface;
import com.inductiveautomation.ignition.common.Dataset;

public class testSQL {
    public static void main(String[] args){
        GatewayInterface gi;
        gi = GatewayConnectionManager.getInstance().getGatewayInterface();
        Dataset ds;
        String query;
        query = "select count(ID) from Visitors";
        try {
            ds = gi.runQuery(query, "NewConnection");
            String t;
            t = "";
            t = ds.getValueAt(0, 0).toString();
            System.out.println(t);
        } catch (GatewayException e1) {
            e1.printStackTrace();
        }
    }
}

```

And the Error:

```auto
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/inductiveautomation/ignition/client/gateway_interface/GatewayException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 7 more

```

Not sure why it wouldn’t be able to find it with this import. Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2020, 6:02pm UTC](https://forum.inductiveautomation.com/t/gatewayexception-class-def-not-found/38103/2 "2020-08-26T18:02:23Z")

</div>

You aren’t going to be able to run any such test scripts (in an IDE or command line). Too much missing infrastructure at a very low level.

There’re hints in various jars suggesting a mock gateway environment is possible, but its all private to IA.
