Example

Here is an example of classloader dependency graph for a webapp:

[silver:silver:1.0] (22862399)
+- [ehcache:ehcache:1.2] (16554308)
+- [org.hibernate:hibernate:3.1.1, org.hibernate:hibernate-annotations:3.1beta8] (28470003)
| +- [ehcache:ehcache:1.1] (9142687)
| | +- [commons-logging:commons-logging:1.0.4] (15401342)
| +- [org.hibernate:hibernate:3.1.1] (11468767)
| | +- [ehcache:ehcache:1.1] (9142687)
| | | +- [commons-logging:commons-logging:1.0.4] (15401342)
| | +- [cglib:cglib:2.1_3] (18916478)
| | | +- [asm:asm:1.5.3] (1012673)
| | +- [commons-collections:commons-collections:2.1.1] (7901508)
| | +- [commons-logging:commons-logging:1.0.4] (15401342)
| | +- [asm:asm:1.5.3] (1012673)
| | +- [javax.transaction:jta:1.0.1B] (25771774)
| | +- [dom4j:dom4j:1.6.1] (25609906)
| | | +- [xml-apis:xml-apis:1.0.b2] (22996593)
| | +- [antlr:antlr:2.7.6rc1] (23794631)
| +- [cglib:cglib:2.1_3] (18916478)
| | +- [asm:asm:1.5.3] (1012673)
| +- [commons-collections:commons-collections:2.1.1] (7901508)
| +- [commons-logging:commons-logging:1.0.4] (15401342)
| +- [javax.persistence:ejb:3.0-public-draft-20060118] (14651230)
| +- [asm:asm:1.5.3] (1012673)
| +- [javax.transaction:jta:1.0.1B] (25771774)
| +- [dom4j:dom4j:1.6.1] (25609906)
| | +- [xml-apis:xml-apis:1.0.b2] (22996593)
| +- [antlr:antlr:2.7.6rc1] (23794631)
+- [yahoo:yahoo-search:1.1.0] (20812788)
+- [commons-logging:commons-logging:1.0.4] (15401342)
+- [xpp3:xpp3:1.1.3.4.O] (29140465)
+- [org.apache.derby:derby:10.1.2.1] (3317565)
+- [org.springframework:spring-core:2.0-m2, org.springframework:spring-beans:2.0-m2, org.springframework:spring-support:2.0-m2] (24418135)
| +- [org.springframework:spring-core:2.0-m2, org.springframework:spring-jdbc:2.0-m2] (24893089)
| | +- [org.springframework:spring-dao:2.0-m2] (21491205)
| | | +- [org.springframework:spring-context:2.0-m2] (22781544)
| | | | +- [org.springframework:spring-aop:2.0-m2] (33353934)
| | | | | +- [org.springframework:spring-beans:2.0-m2] (19230370)
| | | | | | +- [org.springframework:spring-core:2.0-m2] (8548382)
| | | | | | | +- [commons-collections:commons-collections:3.1] (26143190)
| | | | | | | +- [commons-logging:commons-logging:1.0.4] (15401342)
| | | | | | +- [commons-collections:commons-collections:3.1] (26143190)
| | | | | +- [oro:oro:2.0.8] (26872956)
| | | | | +- [aopalliance:aopalliance:1.0] (11120133)
| | | +- [javax.transaction:jta:1.0.1B] (25771774)
| | +- [commons-collections:commons-collections:3.1] (26143190)
| | +- [commons-logging:commons-logging:1.0.4] (15401342)
| +- [commons-collections:commons-collections:3.1, commons-collections:commons-collections:3.1] (31454114)
| +- [commons-logging:commons-logging:1.0.4] (15401342)
+- [xstream:xstream:1.1.3] (32779081)
+- [postgresql:postgresql:8.1-407.jdbc3] (21356612)
+- [opensymphony:quartz:1.5.0] (8831815)
+- [googleapi:google:1.0] (25062038)
+- [log4j:log4j:1.2.8] (8889804)
+- [commons-dbcp:commons-dbcp:1.2.1] (26611461)
| +- [xerces:xerces:2.0.2] (11807935)
| +- [xml-apis:xml-apis:2.0.2] (15054627)
| +- [commons-collections:commons-collections:2.1] (22710119)
| +- [commons-pool:commons-pool:1.2] (7306473)
| | +- [xerces:xerces:2.0.2] (11807935)
| | +- [xml-apis:xml-apis:2.0.2] (15054627)
| | +- [commons-collections:commons-collections:2.1] (22710119)
+- [rhino:js:1.6R2] (24230857)

The number next to the name represent the classloader hashcode. As you can see, dependency of the same maven groupid are in the same bag. Also for same dependency bag the same classloader is used.

You can have here different version of "commons-collections" used in this application without side effect.