I've got a Eclipse Dynamic Web Project which host an easy servlet and operates on Tomcat. I personally use Hibernate within - I've classes that map to database tables and hbm.xml files on their behalf inside my project. Everything works fine - I'm able to use Hibernate from Servlet and modify database tables through classes. However I wish to move my "model" (Java classes for SQL tables and mapping files) to some separate Eclipse project to ensure that I'm able to make use of this "model" using their company projects. Once I specify a reference from my Web project towards the "model" project, Eclipse can easily see the references and enables me using classes, however when I deploy and run the project on Tomcat, you will find always errors like:

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

I suspect the reason being I must put classes for that model into WEB-INF directory, however i don't have any other idea how to get it done than doing the work by hand. What's the right way to configure Web Project for the reason that situation?

It must maintain /WEB-INF/classes, not in /WEB-INF.

Nevertheless, you are meant to put class source files and then any other assets like .hbm.xml files within the project's src folder. Eclispe will "automagically" insert them in the /WEB-INF/classes. Alternatively, if you wish to remove the configuration files in the project, then just place it somewhere outdoors the project inside a fixed path and add this road to the runtime classpath from the server. In Tomcat you can handle individuals pathways in shared.loader property of /conf/catalina.properties.

Nevertheless, you are meant to put class source files and then any other assets like .hbm.xml files within the project's src folder. Eclispe will "automagically" insert them in the /WEB-INF/classes. Alternatively, if you wish to remove the configuration files in the project, then just place it somewhere outdoors the project inside a fixed path and add this road to the runtime classpath from the server