java.lang.NoClassDefFoundError: com/inductiveautomation/perspective/gateway/api/PerspectiveContext

I am trying to learn how to successfully build a custom module for Ignition Perspective but I am running into an issue. I have added a simple react component and built my project successfully and I get the .modl file but when I Ignition tries to load the module it fails with

java.lang.NoClassDefFoundError: com/inductiveautomation/perspective/gateway/api/PerspectiveContext

I have triple checked against the sample project provided by IA but I am not able to find where I went wrong.

PerspectiveContext imports fine with no errors

import java.util.Optional;
import ca.on.listech.perspectivematerial.common.PerspectiveMaterialModule;
import ca.on.listech.perspectivematerial.common.components.TextField;
import com.inductiveautomation.ignition.common.licensing.LicenseState;
import com.inductiveautomation.ignition.common.util.LoggerEx;
import com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook;
import com.inductiveautomation.ignition.gateway.model.GatewayContext;
import com.inductiveautomation.perspective.common.api.ComponentRegistry;
import com.inductiveautomation.perspective.gateway.api.PerspectiveContext;

but when attempting to get the PerspectiveContext it's failing. Here is the startup method where the error it occurring

    public void startup(LicenseState licenseState) {"Starting up Perspective Material Hook");

        this.perspectiveContext = PerspectiveContext.get(this.gatewayContext);
        this.componentRegistry = this.perspectiveContext.getComponentRegistry();

        if (this.componentRegistry != null) {
  "Registering Components");
        } else {
            log.error("Reference to component registry not found, PM Components will fail to function!");

Any ideas?

Can you share your build file? It's likely that your resulting module.xml doesn't declare its dependency on the Perspective module.

1 Like

I think you are right I do not have this line in my module.xml file

<depends scope="DG">com.inductiveautomation.perspective</depends>

That was definitely right! I'm still getting more errors but it's no longer that one.

Thanks! I will continue to try and sort these errors out on my own

1 Like