I'm wonder what would happen, if I have an application with couple ears and wars, and in each of them class named "Test"? Is it jar hell? What classes would load first (from ears or from wars)? Please, send me somewhere, where I can read about this tricky case more detailed.
2 Answers
Servlet containers normally use a one-classloader-per-webapp strategy to avoid this hell. So if you have two applications deployed on the same container, the will have different classloaders which satisfy their class resolution and loading needs. Tomcat has a document for this.
Of course, there are some gotchas like working with JDBC drivers (which are one per JVM process) and JNI (a given library can't be loaded more than once by a given JVM or something along those lines) but the general working remains the same.
4 Comments
You have to use packages. com.foo.Test is different from com.foo2.Test.