
How to Read a Java Stack Trace Correctly and Find the Cause
Read a Java stack trace from the top line down, follow Caused by chains to the root exception and ignore framework frames to find the line in your code.
Tag
223 posts

Read a Java stack trace from the top line down, follow Caused by chains to the root exception and ignore framework frames to find the line in your code.

Build a small JSON REST API in Play with routes, controllers that read and return JSON, validation and consistent error responses.

Build a Micronaut REST API backed by PostgreSQL with Micronaut Data JDBC, repositories generated at compile time, pagination and Flyway migrations.

Write a REST controller in Spring MVC with request mappings, status codes, validation and a test, using a small orders resource as the example.

Configure Spring Boot logging: set levels per package, write rotating files, use profiles, change levels at runtime and add MDC fields.

Write a timing aspect for Spring that flags slow methods: a custom annotation, threshold logging, Micrometer timers and the limits of proxy timing.

Choose between Lombok, records and hand written classes by looking at the type: value objects, JPA entities, builders and mutable beans each have a best fit.

Use ExecutorService correctly: choose a pool type, submit Runnable and Callable, handle Future results and exceptions, bound the queue and shut down cleanly.

Test async code and schedulers in Java reliably: Awaitility instead of sleep, injectable executors, fake clocks and Spring Async and Scheduled.

Turn on unified GC logging, read a G1 log line field by field and recognize the patterns for leaks, undersized heaps, long pauses and allocation spikes.

Implement event sourcing and CQRS in Java: an event store, aggregates rebuilt from events, projections for reads, snapshots and when the cost is justified.

Build a REST API in Quarkus with the quarkus-rest and quarkus-rest-jackson extensions: resources, DTO records, status codes, exception mappers and a test.