question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception thrown when configuring MicrometerPlugin

See original GitHub issue

Actual behavior (the bug) An exception is thrown when using MicrometerPlugin:

Exception in thread "main" kotlin.KotlinNullPointerException
	at io.javalin.core.JavalinServer.server(JavalinServer.kt:32)
	at io.javalin.plugin.metrics.MicrometerPlugin.apply(MicrometerPlugin.kt:16)
	at io.javalin.core.JavalinConfig.lambda$applyUserConfig$5(JavalinConfig.java:192)
	at java.util.HashMap$Values.forEach(HashMap.java:980)
	at io.javalin.core.JavalinConfig.applyUserConfig(JavalinConfig.java:192)
	at io.javalin.Javalin.create(Javalin.java:85)
	at net.selfdotlearn.javalin.App.main(App.java:10)

Expected behavior No exception, Javalin to start successfully.

To Reproduce

public static void main(String[] args) {
    Javalin app = Javalin.create(config -> {
        config.registerPlugin(new MicrometerPlugin());
    });
    app.get("/", ctx -> ctx.result("Hello World"));
    app.start(8080);
}

See the following for a full example exhibiting the behaviour: https://github.com/jon-ruckwood/javalin-micrometer-example

Additional context Dependencies:

  • io.javalin:javalin:3.0.0
  • org.slf4j:slf4j-simple:1.7.25
  • io.micrometer:micrometer-core:1.1.4

Java version:

java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

Let me know if you need anything else.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tipsycommented, Jun 17, 2019

Sure, I was thinking it should be fixed in server() though:

fun server(): Server {
    config.inner.server = config.inner.server ?: JettyUtil.getOrDefault(config.inner.server)
    return config.inner.server!!
}
0reactions
jon-ruckwoodcommented, Jun 19, 2019

Thanks guys!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception thrown when configuring MicrometerPlugin #628
Actual behavior (the bug) An exception is thrown when using MicrometerPlugin : ; Expected behavior. No exception, Javalin to start successfully.
Read more >
javalin-io/general - Gitter
If I understood correctly, I'm supposed to throw exceptions in my Handlers (before/wsBefore methods) to stop further execution of that request.
Read more >
Archive - v3 documentation - Javalin - A lightweight Java and ...
All handlers (before, endpoint, after) can throw Exception (and any subclass of Exception ) The app.exception() method gives you a way of handling...
Read more >
Monitor a Java application | Observability Guide [master] | Elastic
After restarting Filebeat and your Javalin app, trigger an exception, and you will see a long stack trace in the message field of...
Read more >
java - Heeding exceptions thrown when setting Spring Boot ...
I noticed that my Spring Boot (1.3.2) application continues to execute when an essential configuration property cannot be parsed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found