# java.lang.ClassNotFoundException Using AWS JDK

**URL:** <https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720>\
**Category:** Module Development\
**Tags:** ignition80\
**Created:** [July 15, 2020, 7:50am UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720 "2020-07-15T07:50:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhouhcupb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zhouhcupb/32/16095_2.png) [@zhouhcupb](https://forum.inductiveautomation.com/u/zhouhcupb)\
**Post date:** [July 15, 2020, 7:50am UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/1 "2020-07-15T07:50:05Z")

</div>

Hi,

I am new to Ignition module development. I am trying to create some tags and then publish the tag values to AWS CloudWatch using AWS JDK.

This is the link of [my project](https://github.com/ChichiZhou/TagProviderManager/tree/newbranch).

I am using “com.amazonaws.services.cloudwatch.model.Dimension” to create Dimension. But when I installed the module to Ignition platform, there is an ERROR:

```auto
Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.cloudwatch.model.Dimension

```

Full ERROR:

```auto
java.lang.NoClassDefFoundError: com/amazonaws/services/cloudwatch/model/Dimension

at com.inductiveautomation.ignition.examples.mtp.ManagedProviderGatewayHook.readAndPublishTags(ManagedProviderGatewayHook.java:192)

at com.inductiveautomation.ignition.examples.mtp.ManagedProviderGatewayHook.startup(ManagedProviderGatewayHook.java:128)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$LoadedModule.startup(ModuleManagerImpl.java:2386)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.startupModule(ModuleManagerImpl.java:1200)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$2.call(ModuleManagerImpl.java:737)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.executeModuleOperation(ModuleManagerImpl.java:922)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl.installModuleInternal(ModuleManagerImpl.java:700)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$InstallCommand.execute(ModuleManagerImpl.java:1893)

at com.inductiveautomation.ignition.gateway.modules.ModuleManagerImpl$Receiver.receiveCall(ModuleManagerImpl.java:1842)

at com.inductiveautomation.ignition.gateway.redundancy.QueueableMessageReceiver.receiveCall(QueueableMessageReceiver.java:47)

at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl.dispatchMessage(RedundancyManagerImpl.java:912)

at com.inductiveautomation.ignition.gateway.redundancy.RedundancyManagerImpl$ExecuteTask.run(RedundancyManagerImpl.java:984)

at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:518)

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.amazonaws.services.cloudwatch.model.Dimension

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)

... 19 common frames omitted

```

I think the reason maybe the dependency version. But I tried several version of `com.amazonaws`. The error still comes out.

The SDK is JAVA 11,

---

<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 15, 2020, 12:29pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/2 "2020-07-15T12:29:57Z")

</div>

I don’t see any dependencies for this SDK in your gateway pom.xml file.

---

<div class="post-metadata">

**Author:** ![zhouhcupb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zhouhcupb/32/16095_2.png) [@zhouhcupb](https://forum.inductiveautomation.com/u/zhouhcupb)\
**Post date:** [July 15, 2020, 2:35pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/3 "2020-07-15T14:35:35Z")

</div>

Do you mean the “com.amazonaws” in gateway pom.xml?  
I think I do have it. Is this right?

```auto
<dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.819</version>
        </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 15, 2020, 3:46pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/4 "2020-07-15T15:46:16Z")

</div>

Ah, I missed that. Was looking at the bottom of the section.

When you build your module are all the dependency JAR files you expect present? Ignition .modl files are just zip files - you can open it up and investigate.

---

<div class="post-metadata">

**Author:** ![zhouhcupb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zhouhcupb/32/16095_2.png) [@zhouhcupb](https://forum.inductiveautomation.com/u/zhouhcupb)\
**Post date:** [July 15, 2020, 3:56pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/5 "2020-07-15T15:56:05Z")

</div>

Thanks for your help.  
I solve this issue by replacing

```auto
       <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.819</version>
        </dependency>

```

TO

```auto
<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>1.11.819</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.819</version>
        </dependency>

        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-cloudwatch</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-cloudwatchmetrics</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-events</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-logs</artifactId>
        </dependency>
  <dependencies>

```

I have no idea why

```auto
       <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
            <version>1.11.819</version>
        </dependency>

```

does not work in this module.

😨😨😨😨😨😨😨

---

<div class="post-metadata">

**Author:** ![zhouhcupb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zhouhcupb/32/16095_2.png) [@zhouhcupb](https://forum.inductiveautomation.com/u/zhouhcupb)\
**Post date:** [July 15, 2020, 6:27pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/6 "2020-07-15T18:27:36Z")

</div>

To correct my answer.  
The problem is not in the dependency.  
The issue occurs when I use `mvn install`.  
But disappears when I use `mvn package`.

Not know the exact reason yet.  
😕😕😕😕

---

<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 15, 2020, 6:34pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/7 "2020-07-15T18:34:02Z")

</div>

Hmm. Were you relying on `mvn install` posting the module to the Ignition gateway that is configured in developer mode?

I thought we had removed that functionality because it didn’t work right. Stick to using `mvn package` and installing the module yourself.

---

<div class="post-metadata">

**Author:** ![zhouhcupb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zhouhcupb/32/16095_2.png) [@zhouhcupb](https://forum.inductiveautomation.com/u/zhouhcupb)\
**Post date:** [July 15, 2020, 7:03pm UTC](https://forum.inductiveautomation.com/t/java-lang-classnotfoundexception-using-aws-jdk/36720/8 "2020-07-15T19:03:37Z")

</div>

Got it. I used to use `mvn install`. It works for me if I did not import other pacakges. (Only use ignition sdk).

Thanks for your help.  
Appreciate
