# Error while reading the hbm.xml file

**URL:** <https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577>\
**Category:** Hibernate ORM\
**Created:** [October 24, 2018, 1:47am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577 "2018-10-24T01:47:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)\
**Post date:** [October 24, 2018, 1:47am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577/1 "2018-10-24T01:47:41Z")

</div>

I am unable to read hbm.xml. getting the below error.

INFO: HHH000220: Reading mappings from file: Database\_configuration\_files\Delete.hbm.xml  
Error: INFO | jvm 1 | 2018/10/23 13:56:38 | file: Database\_configuration\_files\Delete.hbm.xml not found.

Please find the attachment with structure.  
Please help me to reso ![error](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/hibernate/original/1X/5180f0b98f36c59ce565a59e0bc30e3093f1dfca.png) lve this issue

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [October 24, 2018, 5:20am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577/2 "2018-10-24T05:20:08Z")

</div>

Try it like this:

```
cfg.addFile("commonInterface/Database_configuration_files/Delete.hbm.xml");
```

---

<div class="post-metadata">

**Author:** ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)\
**Post date:** [October 24, 2018, 6:37am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577/3 "2018-10-24T06:37:20Z")

</div>

cfg.addFile(“Database\_configuration\_files/Delete.hbm.xml”) is working fine. when i am creating a runnable jar for the above code. I am getting this error " HHH000220: Reading mappings from file: Database\_configuration\_files\Delete.hbm.xml ".

Let me know if you need any additional information.

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [October 24, 2018, 7:03am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577/4 "2018-10-24T07:03:05Z")

</div>

The `Configuration` bootstrap is deprecated. Also, you need to use a build tool like Maven to build a project, not from the IDE.

In your case, you should use `addResource`:

```auto
cfg.addResource("commonInterface/Database_configuration_files/Delete.hbm.xml");

```

The `addFile` works with file paths that can be resolved on disk, not on the classpath. So, unless you are using an absolute file path, the program will run only when the relative path can be resolved from the calling command path.

---

<div class="post-metadata">

**Author:** ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)\
**Post date:** [October 24, 2018, 7:37am UTC](https://discourse.hibernate.org/t/error-while-reading-the-hbm-xml-file/1577/5 "2018-10-24T07:37:48Z")

</div>

Thank you so much. This helped me to resolve the issue. Thank you
