Troubleshooting for Java SDK
Understand what to do when you encounter the most common issues.
java.lang.NoClassDefFoundError: kotlin/enums/EnumEntriesKt
If you encounter java.lang.NoClassDefFoundError: kotlin/enums/EnumEntriesKt
, ensure that the effective Kotlin version in your project is 1.9+
. This is required for the PubNub Java SDK to work properly.
Root cause
The java.lang.NoClassDefFoundError: kotlin/enums/EnumEntriesKt
error may occur when an old version of spring-boot-dependencies
is defined in the dependency-management
section of pom.xml
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.13</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
In such case, dependencies like kotlin-stdlib
and kotlin-stdlib-common
are enforced in version 1.6.21
that is too old for the PubNub Java SDK to work properly.
Fix
There are two ways to fix the java.lang.NoClassDefFoundError: kotlin/enums/EnumEntriesKt
issue:
-
Add explicit declarations of
kotlin-stdlib
andkotlin-stdlib-common
in version1.9.+
to yourpom.xml
file.<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.10</version>
</dependency><dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.9.10</version>
</dependency> -
Update the
spring-boot
version to one that enforceskotlin-stdlib
andkotlin-stdlib-common
in version1.9.+
, such as3.4.5
or higher.