Search code examples
javaxmlhibernateredhat

JAVA & Hibernate - Impossible to generate XML


We are working on a project in order to improve our java skills using Hibernate, but we have a problem when we try to generate the XML files for our classes to be linked with the database.

Indeed, we encounter an error that didn't happened before, when we generate XML files for our classes, the error messages shows :

An error has occurred. See error log for more details.
Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

And when we look at the error logs, we have those errors:

error logs

In the past, we just had to right click on our class, select "New", then "Other", then select Hibernate XML Mapping File. This worked, but now we have the errors that we showed you just before.

We don't know what is going on, and what went wrong because this worked before.

Thanks a lot for your help, and have a nice week.


Solution

  • Check all the hibernate related jars are placed in your classpath.

    Check the database driver related jars are placed in your classpath.

    Check whether the hibernate/JPA annotations are placed in all the Entity classes or not.

    Check the hibernate connection properties such as DB driver(Connection URL/port/username/password) and other properties are properly working or not in hibernate.cfg.xml file or persistence.xml file.

    Check whether the hibernate specific configuration/mapping files and JPA file such as:persistence.xml file are placed in proper classpath or not