I have a java project (calling it ProjectA) that contain all my hibernate mappings xml files inside classpath along with model classes. I then have second web project(ProjectB) that uses those. I have successfuly added ProjectA as dependecies into ProjectB's under "Java Build Path" settings, and compile will see the depended classes.
But I run into problem when starting up ProjectB as webapp in a eclipse's tomcat server. It complains missing and not able to load hibernate mapping resource files from classpath. Any one done this because who can give me some point on how to setup eclipse with these projects?
I think I understood what you're saying. The thing to keep in mind is that in Tomcat, each webapp has its own classpath. What Eclipse thinks of as the classpath may not be the same thing - especially if you're trying to draw from multiple projects.
For a simple WAR-type webapp, the only classes Tomcat will see are those in the webapp's WEB-INF/classes and WEB-INF/libs (unless you start adding custom classloaders). And if you have multiple webapps, each webapp will have its own classpath configuration. The webapps can also draw on classes defined at the Tomcat global level, but you should leave that option for truly global classes - like logging libraries and maybe JDBC driver JARs. I personally don't recommend putting framework libraries such as Hibernate in the Tomcat shared library directories. At best, it makes portability and version independence difficult, and in worse cases, may cause unpredictable results due to multi-threading and shared resource conflicts.
The documentation for how Tomcat's classpath hierarchy works is graphed out in detail at the jakarta.apache.org/tomcat website.
Normally what you'd do in terms of a 2-project Tomcat solution would either be a case where you have 2 webapps - and the safest way for them to talk is usually HTTP requests between them. Or you might define a JAR as an Eclipse project and include the constructed JAR into a webapp project. However, if you do that, what you actually have to do is make the JAR project build a JARfile and then have a copy of that JARfile copied into the webapp project's WEB-INF/lib directory. You'd set the Eclipse project dependencies to tell Eclipse that the JAR has to be built before the webapp.
Customer surveys are for companies who didn't pay proper attention to begin with.
We are using the Development-Webapp Classloader together with the sysdeo plugin, as outlined at http://www.eclipsetotale.com/tomcatPlugin/readmeDevLoader.html (I think the comment on the devloader only being available for Tomcat 4 is outdated). That way we we can run a webapp consisting of dozens of Eclipse projects directly from inside Eclipse - no need for the creation of any jars or wars. Works great.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Well, I usually only actually create WAR files when I'm ready to ship a deployable, but I build into an exploded WAR (typically a directory named build/webapp). I use sysdeo. And one of the reasons I tend to prefer Eclipse over IntelliJ is because I not uncommonly am running multiple intercommunicating webapps (and other things) concurrently within the Eclipse debugging environment.
Or have you managed to bypass the WAR structure altogether. And if so, how?
subject: Setting up project dependencies in eclipse