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

**URL:** <https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252>\
**Category:** Module Development\
**Tags:** ignition81, perspective\
**Created:** [February 5, 2024, 7:59pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252 "2024-02-05T19:59:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chad\_Gregory](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chad_gregory/32/51192_2.png) [@Chad\_Gregory](https://forum.inductiveautomation.com/u/Chad_Gregory)\
**Post date:** [February 5, 2024, 7:59pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/1 "2024-02-05T19:59:28Z")

</div>

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

```java
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

```java
@Override
    public void startup(LicenseState licenseState) {
        log.info("Starting up Perspective Material Hook");

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

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

```

Any ideas?

---

<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 5, 2024, 8:03pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/2 "2024-02-05T20:03:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chad\_Gregory](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chad_gregory/32/51192_2.png) [@Chad\_Gregory](https://forum.inductiveautomation.com/u/Chad_Gregory)\
**Post date:** [February 5, 2024, 8:11pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/3 "2024-02-05T20:11:16Z")

</div>

> [@Kevin.Herron](#):
>
> share your build file? It's likely that your resulting module.xml doesn't declare its dependency on the Perspective module.

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

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

```

---

<div class="post-metadata">

**Author:** ![Chad\_Gregory](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chad_gregory/32/51192_2.png) [@Chad\_Gregory](https://forum.inductiveautomation.com/u/Chad_Gregory)\
**Post date:** [February 5, 2024, 8:29pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/4 "2024-02-05T20:29:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mats\_Sommervold](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mats\_Sommervold](https://forum.inductiveautomation.com/u/Mats_Sommervold)\
**Post date:** [July 8, 2024, 1:05pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/5 "2024-07-08T13:05:20Z")

</div>

I am getting the same error and I don't understand the proposed solution to this thread. I have the `perspective-gateway` from `com.inductiveautomation.ignitionsdk` in my gateway pom file. My IDE has no problem autocompleting the imports. Is this the correct dependency?

What's in my pom:

```python
<dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>perspective-gateway</artifactId>
            <version>${ignition-sdk-version}</version> <!-- we use version 8.1.33 -->
            <type>pom</type>
            <scope>provided</scope>
</dependency>

```

---

<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:** [July 8, 2024, 1:09pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/6 "2024-07-08T13:09:15Z")

</div>

There is a separate section in your pom.xml where you add settings that end up in the module.xml file, and one of those settings declares what other modules your module depends on. It's not the same thing as declaring a Maven dependency.

It's equivalent to this section of the device example that declares itself dependent on the OPC UA module: [ignition-sdk-examples/opc-ua-device/opc-ua-device-build/pom.xml at 276f89239073e2108253716bce7f4ff70d20698d · inductiveautomation/ignition-sdk-examples · GitHub](https://github.com/inductiveautomation/ignition-sdk-examples/blob/276f89239073e2108253716bce7f4ff70d20698d/opc-ua-device/opc-ua-device-build/pom.xml#L55-L60)

> [@Chad\_Gregory](#):
>
> I think you are right I do not have this line in my module.xml file
> 
> ```python
> <depends scope="DG">com.inductiveautomation.perspective</depends>
> 
> ```

---

<div class="post-metadata">

**Author:** ![Mats\_Sommervold](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Mats\_Sommervold](https://forum.inductiveautomation.com/u/Mats_Sommervold)\
**Post date:** [July 10, 2024, 1:57pm UTC](https://forum.inductiveautomation.com/t/java-lang-noclassdeffounderror-com-inductiveautomation-perspective-gateway-api-perspectivecontext/85252/7 "2024-07-10T13:57:08Z")

</div>

Ahh, that makes sense, Thank you!
