To what is the class path of a Servlet container set?
As per my understanding there are three components involved. The JAR files in the lib directory of the Servlet container and then the classes in the WEB-INF/classes and JAR files in the WEB-INF/lib directory. The classes in lib directory of the Servlet container are added to the system classpath and the dynamic classpath includes the JAR files in the lib directory and classes in the classes directory.
To what is the dynamic classpath set? Does the dynamic classpath point to all the directories under WEB-INF or includes all the individual classes and JAR files in WEB-INF/lib and WEB-INF/classes or just points to the two directories WEB-INF/classes and WEB-INF/lib? Say I have a directory called foo in WEB-INF containing bar.properties. Now is bar.properties also in the class path?
The ‘dynamic’ classpath will list
WEB-INF/classesand each JAR file underWEB-INF/libas a separate entry. Other folders underWEB-INFare not included.In your example,
bar.propertieswill not be on the classpath. Move it toWEB-INF/classes, or put it inside a JAR file underWEB-INF/lib.What’s in the rest of the classpath depends on your servlet container. It is implementation-specific, but most containers have two other places to put classes. One is a directory that is visible to the container, but not the applications, and the other is visible to the container and all of the applications. Since the second classloader is visible to all of the applications, static members of those classes can be used to share information between applications.