# Module fails to load with NoClassDefFoundError, but works locally

**URL:** <https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525>\
**Category:** Module Development\
**Tags:** ignition81\
**Created:** [February 19, 2025, 1:34am UTC](https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525 "2025-02-19T01:34:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry\_Sadoyan](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@Harry\_Sadoyan](https://forum.inductiveautomation.com/u/Harry_Sadoyan)\
**Post date:** [February 19, 2025, 1:34am UTC](https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525/1 "2025-02-19T01:34:50Z")

</div>

My Ignition Module uses gRPC to send requests to an external server. In my gateway's `build.gradle.kts` I add the gRPC dependencies for version `1.70.0`

```python
dependencies {
    // Ignition dependencies
    implementation("com.inductiveautomation.ignitionsdk:ignition-common:${rootProject.extra["sdk_version"]}")
    implementation("com.inductiveautomation.ignitionsdk:gateway-api:${rootProject.extra["sdk_version"]}")
    compileOnly(project(":common"))

    // gRPC and Proto
    runtimeOnly("io.grpc:grpc-netty-shaded:$grpcVersion")
    api("com.google.protobuf:protobuf-java:$protobufVersion")
    api("io.grpc:grpc-protobuf:$grpcVersion")
    api("io.grpc:grpc-stub:$grpcVersion")
    api("io.grpc:grpc-core:$grpcVersion")
    api("io.grpc:grpc-api:$grpcVersion")
    compileOnly("org.apache.tomcat:annotations-api:6.0.53") // necessary for Java 9+

    testImplementation("io.grpc:grpc-testing:$grpcVersion")
    testImplementation("io.grpc:grpc-inprocess:$grpcVersion")
}

```

I initialize the gRPC service's ManagedChannel in the GatewayHook's `startup`.

I can build locally and run tests, but when I upload the .modl file I immediately get a fault with `NoClassDefFoundError` on the grpc code.

```python
java.lang.Exception: Exception while starting up module "com.company.moduleName"
Caused by: java.lang.NoClassDefFoundError: io/grpc/StatusRuntimeException
Caused by: java.lang.ClassNotFoundException: io.grpc.StatusRuntimeException

```

As far as I can tell the jars are being built correctly.  
`./gradlew gateway:dependencies --configuration runtimeClasspath` shows all the dependencies I'd expect.

I added a `Main.java` class and ran the code locally, and can successfully execute the gRPC requests.

Am I doing something wrong in the module build? Are the dependencies not being packaged correctly into the .modl? Or is it because something isn't loaded yet in `startup`? I'm fairly new to gradle, so I may have missed something obvious.

Using java17 and building for ignition 8.1.

---

<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 19, 2025, 1:41am UTC](https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525/2 "2025-02-19T01:41:15Z")

</div>

> [@Harry\_Sadoyan](#):
>
> Am I doing something wrong in the module build? Are the dependencies not being packaged correctly into the .modl?

Unzip the module and take a look for yourself. The `.modl` file is just a zip file.

---

<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 19, 2025, 1:44am UTC](https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525/3 "2025-02-19T01:44:11Z")

</div>

Also, if you're using the Ignition gradle plugin, I think the dependencies you want packaged into the module need to be declared with the `modl*` dependency syntax, e.g.

```python
    modlApi("com.google.protobuf:protobuf-java:$protobufVersion")
    modlApi("io.grpc:grpc-protobuf:$grpcVersion")

```

---

<div class="post-metadata">

**Author:** ![Harry\_Sadoyan](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@Harry\_Sadoyan](https://forum.inductiveautomation.com/u/Harry_Sadoyan)\
**Post date:** [February 19, 2025, 1:50am UTC](https://forum.inductiveautomation.com/t/module-fails-to-load-with-noclassdeffounderror-but-works-locally/102525/4 "2025-02-19T01:50:56Z")

</div>

Yup, that did it.

Thank you! I was losing it trying to figure out why the dependency isn't found.
