Category: troubleshooting
-
ArithmeticException in Java – Causes & Treatment
In this tutorial, we will introduce a few examples that would highlight the causes of getting an ArithmeticException thrown within a Java program. We will discuss the common causes of the exception, and how these could be treated. What is an ArithmeticException? An arithmetic exception is an error that is thrown when an invalid arithmetic…
-
Java ArrayIndexOutOfBoundsException – Causes & Fixes
In this tutorial, we will discuss what a Java ArrayIndexOutOfBoundsException is, what causes it and how to make sure that you avoid it. What is an ArrayIndexOutOfBoundsException An array-index out of bounds exception is a Java exception thrown due to the fact that the program is trying to access an element at a position that…
-
Troubleshooting a PropertyNotFoundException in JPA
In this post, we discuss yet another reason for having a mapping error from Hibernate. This specific one is called a PropertyNotFoundException. If you have made sure that your property is correctly mapped to the database table, with correct column names and a getter and a setter for the property, then read on!. Let us…
-
How to manage JPA bidirectional relationships properly
In this troubleshooting guide, we will explore how to properly map bidirectional relationships and common mapping pitfalls that cause exceptions such as DataIntegrityViolationException, a ConstrainViolationException and a PropertyValueException. We will take an unusual approach in this guide by first building the faulty software, and then we will discuss how and why this should be fixed.…
-
org.hibernate.MappingException: Could not determine type for: java.util.List – Causes & Fixes
In this post, we will explore a very common Hibernate error, namely a MappingException caused by missing annotations on the Entity getters and fields. The error Let us check the following stack trace as an example: java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource…
-
Java NullPointerException – examples, causes and fixes
Probably one of the most common and annoying exceptions to be encountered by any Java developer is the dreaded “NullPointerException”. A null pointer exception is thrown when an “illegal” referencing of a null object is performed. A “null” object is an object which is not initialized. Let us explore some examples of how a null…