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();
        } catch (GatewayException e1) {

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(
	at java.lang.Class.privateGetMethodRecursive(
	at java.lang.Class.getMethod0(
	at java.lang.Class.getMethod(
	at sun.launcher.LauncherHelper.validateMainClass(
	at sun.launcher.LauncherHelper.checkAndLoadMain(
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException
	at java.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	... 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