Checked and Unchecked Exceptions in Java 1. Overview Java exceptions fall into two main categories: checked exceptions and unchecked exceptions. In this article, we’ll provide some code samples on how to use them. 2. Checked Exceptions In general, checked exceptions represent errors outside the control of the program. For example,… Continue Reading java-checked-unchecked-exceptions

Jackson – JsonMappingException (No serializer found for class) 1. Overview In this quick tutorial, we will analyze the marshalling of entities with no getters and the solution for the Jackson JsonMappingException exception. If you want to dig deeper and learn other cool things you can do with the Jackson 2… Continue Reading jackson-jsonmappingexception

ClassNotFoundException vs NoClassDefFoundError 1. Introduction Both ClassNotFoundException and NoClassDefFoundError occur when the JVM can not find a requested class on the classpath. Although they look familiar, there are some core differences between these two. In this tutorial, we’ll discuss some of the reasons for their occurrences and their solutions. 2.… Continue Reading java-classnotfoundexception-and-noclassdeffounderror

Avoiding the ConcurrentModificationException in Java Java Exception 1. Introduction In this article, we’ll take a look at the ConcurrentModificationException class. First, we’ll give an explanation how it works, and then prove it by using a test for triggering it. Finally, we’ll try out some workarounds by using practical examples. 2.… Continue Reading java-concurrentmodificationexception

Create a Custom FailureAnalyzer with Spring Boot 1. Overview A FailureAnalyzer in Spring Boot offers a way to intercept exceptions that occur during the startup of an application causing an application startup failure. The FailureAnalyzer replaces the stack trace of the exception with a more readable message represented by a… Continue Reading spring-boot-failure-analyzer

OutOfMemoryError: GC Overhead Limit Exceeded 1. Overview Simply put, the JVM takes care of freeing up memory when objects are no longer being used; this process is called Garbage Collection (GC). The GC Overhead Limit Exceeded error is one from the family of java.lang.OutOfMemoryError and is an indication of a… Continue Reading java-gc-overhead-limit-exceeded

The HttpMediaTypeNotAcceptableException in Spring MVC 1. Overview In this quick article, we’ll have a look at the HttpMediaTypeNotAcceptableException exception, and understand the cases where we might encounter it. 2. The Problem When implementing an API endpoint with Spring, we generally need to specify the consumed/produced media types (via the consumes… Continue Reading spring-httpmediatypenotacceptable

Introduction to NoException 1. Overview Sometimes try/catch blocks can result in verbose or even awkward code constructs. In this article, we’ll focus on NoException which provides concise and handy exception handlers. 2. Maven Dependency Let’s add the NoException to our pom.xml: <dependency> <groupId>com.machinezoo.noexception</groupId> <artifactId>noexception</artifactId> <version>1.1.0</version> </dependency> 3. Standard Exception Handling… Continue Reading no-exception