Eclipse Dynamic Web Project - MappingNotFoundException

I have an Eclipse Dynamic Web Project that hosts a simple servlet and runs on Tomcat. I use Hibernate internally - I have classes that map to database tables and hbm.xml files for them in my project. Everything works fine - I can use Hibernate from Servlet and modify database tables through classes. But now I want to transfer my “model” (Java classes for SQL tables and mapping files) to a separate Eclipse project so that I can use this “model” from other projects. After I point out the link from my web project to the “model” project, Eclipse can see the links and allows me to use classes, but when I deploy and run the project on Tomcat, errors always appear such as:

org.hibernate.MappingNotFoundException: resource: xxx / yyy / zzz / model / MyClassTable.hbm.xml not found

I suspect this is because I have to put the classes for the model in the WEB-INF directory, but I have no other idea how to do this than to do it manually. What is the correct way to set up a web project in this case?

+3
source share
2 answers

It should be in /WEB-INF/classes, not in /WEB-INF.

, , .hbm.xml src. Eclispe "" /WEB-INF/classes. , , - . Tomcat shared.loader /conf/catalina.properties.

+2

, , .hbm.xml src . Eclispe "" /WEB -INF/. , , -

0

Source: https://habr.com/ru/post/1731412/


All Articles