Hibernate Error: Failed to create sessionFactory object.java.lang.NoClassDefFoundError

In this tutorial we will solve the Hibernate Error: Failed to create sessionFactory object.java.lang.NoClassDefFoundError


What is difference between Hibernate 4 and 5? Hibernate 5.3 features Hibernate 5 JPA Configuration Hibernate 5 persistence.xml example Hibernate 5 JPA Tutorial Hibernate and JPA Example How properties of a class are mapped to the columns of a database table in Hibernate? Hibernate 5 Annotations Maven dependency Hibernate 5 annotationconfiguration Doctype Hibernate-configuration 5 Hibernate 5 Dialect Hibernate 5 configuration dtd Hibernate 5 Hello World Getting started with Hibernate 5 Hibernate 5.2.10 jar Download Hibernate 5.2.10 Maven Dependency Hibernate 5 Maven Dependency Hibernate 5 native query example Hibernate 5 query deprecated When should you use Hibernate? What's new in Hibernate 5? How much time it takes to learn Hibernate? Hibernate envers custom revinfo table Hibernate 5 Envers Hibernate Envers get all revisions Hibernate Examples Hibernate 5 build SessionFactory Example Hibernate 5 SessionFactory Example Hibernate 5 Annotation Example How to download Hibernate 5.x? Hibernate 5 Features Hibernate 5 Tutorials Learning Hibernate ORM - Free Training/Tutorial videos of Hibernate ORM with Java How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate ORM 4.2.21.Final Released - Create CURD application in latest Hibernate Hibernate ORM 4.2.21 Tutorial - Learn Hibernate ORM Framework Hibernate Error: Failed to create sessionFactory object.java.lang.NoClassDefFoundError How to create Hibernate Project in Eclipse?

In this video you will learn why this error comes in the Hibernate project and how to solve the error? While working on a Hibernate/Java based after update of some of the jar file of the old version of Hibernate to new version of Hibernate this error occurred.

This is the runtime error and Hibernate application was not starting, so I searched and found that the error was due to unavailability of the dom4j jar file.

I checked the Hibernate download by extracting the zip file and found the dom4j-1.6.1.jar. After adding this jar file into the project error was resolved.

My project is actually based on the xml configuration file and Hibernate requires this jar file for parsing the xml file.

Following error was coming before adding the dom4j-1.6.1.jar file into project:

Failed to create sessionFactory object.java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Exception in thread "main" java.lang.NullPointerException
at net.roseindia.PersonDetail.main(PersonDetail.java:43)

Here is the video tutorial which explains you how to solve the error:

In this video you will see the steps to resolve the error by adding the dom4j-1.6.1.jar file into the project and then run the Hibernate application.

Check more tutorials at: