Hibernate : classpath resource cannot be opened because it does not exist

11,366

I finally found a way to get it to work by specifying an absolute path instead of a relative path in my applicationcontext.xml file. In concrete terms, I changed "com/xxx/file.hbm.xml" to "/resources/com/xxx/file.hbm/xml". Thanks to duffymo for leading me to the right way.

Share:
11,366
Sara
Author by

Sara

Developer from France. Mainly develop in Java, C# and Javascript. Loves HTML5/CSS3.

Updated on June 14, 2022

Comments

  • Sara
    Sara almost 2 years

    I have a Maven project using Spring and Hibernate. When I launch it in Eclipse using Debug As > Java Application, it works great. But once I exported it as a runnable .jar file, it gives me this error :

    class path resource [com/xxx/file.hbm.xml] cannot be opened because it does not exist
    

    But when I open the .jar file, the file is located under /resources/com/xxx.file.hbm.xml. What did I do wrong ?

    Thank you.