Search code examples
mavenkotlinjavalin

Javalin tutorial yielding "Unresolved reference: AtomicInteger"


Title says it. Following the Javalin tutorial as part of learning kotlin and getting the Unresolved Reference on mvn package. I imagine I need to pull in a dependency, but the example doesn't show it and Google is failing me. My pom.xml is large-ish, but my version info is as follows:

<properties>
    <kotlin.version>1.1.3-2</kotlin.version>
</properties>

and my current dependency list is:

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jre8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>io.javalin</groupId>
        <artifactId>javalin</artifactId>
        <version>0.3.3</version>
    </dependency>
</dependencies>

Not really sure where to go from here.


Solution

  • In the class UserDao you've forgotten to add the following import

    import java.util.concurrent.atomic.AtomicInteger
    

    All the sources for the sample are available on github (https://github.com/tipsy/javalin-kotlin-example) so you can look that up as reference.