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

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

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: