# NoClassDefFoundError persepective-component

**URL:** <https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951>\
**Category:** Ignition\
**Tags:** sdk, perspective\
**Created:** [October 2, 2023, 11:31pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951 "2023-10-02T23:31:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willem\_van\_Deventer](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@Willem\_van\_Deventer](https://forum.inductiveautomation.com/u/Willem_van_Deventer)\
**Post date:** [October 2, 2023, 11:31pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/1 "2023-10-02T23:31:32Z")

</div>

# NoClassDefFoundError

Currntly i'm trying to use the persepective-component example to create a component in an existing ignition module. I coppied over the code from example and then found the mavern equivalent dependines since the example is based on Gradle. My dev environment matches the versuins listed below. I've also added the code snippet where the error is thrown.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/4597ffed9b928c56f7ff9366b64b5c5da4059ea8.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/a/9ace0a3fa198f6a2a8cc17fba55edb039315b2d2.png)

Example Link: [ignition-sdk-examples/perspective-component at master · inductiveautomation/ignition-sdk-examples · GitHub](https://github.com/inductiveautomation/ignition-sdk-examples/tree/master/perspective-component)

## Dependencies

| groupId | artifactId | version | scope |
| --- | --- | --- | --- |
| com.inductiveautomation.perspective | perspective-gateway | 2.1.25 | provided |
| com.inductiveautomation.ignitionsdk | perspective-common | 8.1.25 | provided |
| com.inductiveautomation.ignitionsdk | ignition-common | 8.1.25 | provided |
| com.inductiveautomation.ignitionsdk | gateway-api | 8.1.25 | provided |

## Gateway Error

```
java.lang.NoClassDefFoundError: com/inductiveautomation/perspective/gateway/api/PerspectiveContext
at ami.GatewayHook.startup(GatewayHook.java:63)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.startup(ModuleManagerImpl.java:2439)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1232)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:777)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:953)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:743)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1909)
at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1862)
at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:47)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:1030)
at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:1098)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:544)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.inductiveautomation.perspective.gateway.api.PerspectiveContext
at java.base/java.net.URLClassLoader.findClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:37)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader.loadClass(ModuleClassLoader.java:85)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)

```

## Code Snippet

```python
@Override
public void startup(LicenseState licenseState) {
    this.perspectiveContext = PerspectiveContext.get(this.gatewayContext); //LINE 63: Error is Thrown
    this.componentRegistry = this.perspectiveContext.getComponentRegistry();
    this.modelDelegateRegistry = this.perspectiveContext.getComponentModelDelegateRegistry();

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

    if (this.modelDelegateRegistry != null) {
        log.info("Registering model delegates.");
        this.modelDelegateRegistry.register(Messenger.COMPONENT_ID, MessageComponentModelDelegate::new);
    } else {
        log.error("ModelDelegateRegistry was not found!");
    }
}

```

---

<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:** [October 2, 2023, 11:37pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/2 "2023-10-02T23:37:56Z")

</div>

You probably didn't build your module so that it indicates it depends on the Perspective module.

What does the pom.xml that configures the Ignition maven plugin look like?

---

<div class="post-metadata">

**Author:** ![Willem\_van\_Deventer](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@Willem\_van\_Deventer](https://forum.inductiveautomation.com/u/Willem_van_Deventer)\
**Post date:** [October 2, 2023, 11:42pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/3 "2023-10-02T23:42:17Z")

</div>

> [@Kevin.Herron](#):
>
> maven plugin l

### Gateway pom

```python
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>ami-mes</artifactId>
        <groupId>ami</groupId>
        <version>1.0.1</version>
    </parent>

    <artifactId>ami-mes-gateway</artifactId>

    <dependencies>

        <!-- https://mvnrepository.com/artifact/com.inductiveautomation.perspective/perspective-gateway -->
        <dependency>
            <groupId>com.inductiveautomation.perspective</groupId>
            <artifactId>perspective-gateway</artifactId>
            <version>2.1.25</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.websocket</groupId>
            <artifactId>javax.websocket-api</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>perspective-common</artifactId>
            <version>8.1.25</version>
            <scope>provided</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>ignition-common</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>ignition-common</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>gateway-api</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>driver-api</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-client</artifactId>
            <version>1.0.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-common</artifactId>
            <version>1.0.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>compile</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

```

### Common pom

```python
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>ami-mes</artifactId>
        <groupId>ami</groupId>
        <version>1.0.1</version>
    </parent>

    <artifactId>ami-mes-common</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>ignition-common</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignition</groupId>
            <artifactId>client-api</artifactId>
            <version>8.1.25</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.inductiveautomation.ignitionsdk</groupId>
            <artifactId>perspective-common</artifactId>
            <version>8.1.25</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

```

---

<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:** [October 2, 2023, 11:43pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/4 "2023-10-02T23:43:07Z")

</div>

No, not either of those. How are you building the `.modl` file? Are you not using the ignition-maven-plugin?

---

<div class="post-metadata">

**Author:** ![Willem\_van\_Deventer](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@Willem\_van\_Deventer](https://forum.inductiveautomation.com/u/Willem_van_Deventer)\
**Post date:** [October 2, 2023, 11:53pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/5 "2023-10-02T23:53:19Z")

</div>

> [@Kevin.Herron](#):
>
> ignition-maven-plugin

I pressume this is what your after since it references the mavern plugin. If not then i'll have to look into the matter and get back to you.

### Build pom

```python
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>ami-mes</artifactId>
        <groupId>ami</groupId>
        <version>1.0.1</version>
    </parent>

    <artifactId>ami-mes-build</artifactId>
    <properties>
        <module-version>${project.parent.version}</module-version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-client</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-common</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-designer</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>ami</groupId>
            <artifactId>ami-mes-gateway</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.inductiveautomation.ignitionsdk</groupId>
                <artifactId>ignition-maven-plugin</artifactId>
                <version>1.1.0</version>

                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>modl</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <projectScopes>
                        <projectScope>
                            <name>ami-mes-client</name>
                            <scope>C</scope>
                        </projectScope>
                        <projectScope>
                            <name>ami-mes-common</name>
                            <scope>CDG</scope>
                        </projectScope>
                        <projectScope>
                            <name>ami-mes-designer</name>
                            <scope>CD</scope>
                        </projectScope>
                        <projectScope>
                            <name>ami-mes-gateway</name>
                            <scope>G</scope>
                        </projectScope>
                    </projectScopes>

                    <moduleId>ami.ami-mes</moduleId>
                    <moduleName>${project.parent.name}</moduleName>
                    <moduleDescription>${project.description}</moduleDescription>
                    <moduleVersion>1.0.0</moduleVersion>
                    <requiredIgnitionVersion>8.1.25</requiredIgnitionVersion>

                    <hooks>
                        <hook>
                            <scope>C</scope>
                            <hookClass>ami.client.ClientHook</hookClass>
                        </hook>
                        <hook>
                            <scope>D</scope>
                            <hookClass>ami.designer.DesignerHook</hookClass>
                        </hook>
                        <hook>
                            <scope>G</scope>
                            <hookClass>ami.GatewayHook</hookClass>
                        </hook>
                    </hooks>

                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

```

---

<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:** [October 2, 2023, 11:54pm UTC](https://forum.inductiveautomation.com/t/noclassdeffounderror-persepective-component/79951/6 "2023-10-02T23:54:47Z")

</div>

Yeah, it's missing a `<depends>` section that declares a dependency on the Perspective module, similar to [this one](https://github.com/inductiveautomation/ignition-sdk-examples/blob/da3c7e073686f62dbbd6d228ed55468b6d7f1575/opc-ua-device/opc-ua-device-build/pom.xml#L55-L60) used in the device example declaring a dependency on the OPC UA module.
