Italux
Italux

Reputation: 95

io.micronaut.runtime.Micronaut - No embedded container found

I'm trying to build a Kotlin application but, even with successfully build, I face with the error bellow. What I'm doing wrong?

▶ java -jar build/libs/app-0.1.jar
22:10:02.122 [main] INFO  io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application

Here is my build status:

▶ ./gradlew assemble

BUILD SUCCESSFUL in 3s
14 actionable tasks: 1 executed, 13 up-to-date

That is the part of my gradle.build file:

apply from: "dependencies.gradle"
apply from: "protobuf.gradle"

version "0.1"
group "app"
mainClassName = "app.Application"

dependencies {
    compile "ch.qos.logback:logback-classic:1.2.3"
}

jar {
    manifest {
        attributes "Main-Class": mainClassName
    }
    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

Upvotes: 3

Views: 3677

Answers (2)

peppered
peppered

Reputation: 698

I had a similar issue:

  1. I was able to run code from IDE, but failed to run Docker container with the app
  2. And had compile 'io.micronaut:micronaut-http-server-netty:1.1.0' in my build.gradle.

Also I was using shadowJar plugin and there was the issue. Adding:

shadowJar {
    mergeServiceFiles()
}

solved the problem. It transforms entries in META-INF/services resources into a single resource. My shadowed jar file contained a lot of entries in this folder.

Upvotes: 2

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27220

It is difficult to say for sure without seeing the project but one thing that could cause that issue would be not having a dependency on io.micronaut:micronaut-http-server-netty. A newly created app will have something like this in build.gradle...

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}"
    compile "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
    compile "io.micronaut:micronaut-runtime"
    compile "io.micronaut:micronaut-http-client"

    // Make Sure You Have This...
    compile "io.micronaut:micronaut-http-server-netty"

    kapt "io.micronaut:micronaut-inject-java"
    kapt "io.micronaut:micronaut-validation"
    kaptTest "io.micronaut:micronaut-inject-java"
    runtime "ch.qos.logback:logback-classic:1.2.3"
    runtime "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.4.1"
    testCompile "org.junit.jupiter:junit-jupiter-api:5.1.0"
    testCompile "org.jetbrains.spek:spek-api:1.1.5"
    testRuntime "org.junit.jupiter:junit-jupiter-engine:5.1.0"
    testRuntime "org.jetbrains.spek:spek-junit-platform-engine:1.1.5"
}

Upvotes: 0

Related Questions