GatewayException class def not found

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:


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:

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!

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.

1 Like