Skip to Content
1
Former Member
Jan 20, 2016 at 08:47 PM

Classloader

601 Views

What are the details of the classloader in hybris; specifically what is the default? Ideally, you'd want one version/copy of jar loaded into the path/jvm only. I'm unable to determine what the classpath analyzer is telling me other than I do have duplicate jars within different paths.

I've reviewed the wiki page - https://wiki.hybris.com/display/release5/Classpath+Analyzer and I get output that indicates duplicate jars have been loaded:

commons-codec-1.7.jar (1) file:/C:/hybris/bin/platform/ext/core/lib/commons-codec-1.7.jar de.hybris.bootstrap.loader.PlatformInPlaceClassLoader@606e76b4 jar commons-codec-1.7.jar (2) file:/C:/hybris/bin/ext-platform-optional/lucenesearch/lib/commons-codec-1.7.jar de.hybris.bootstrap.loader.PlatformInPlaceClassLoader@606e76b4 jar commons-codec-1.7.jar (3) file:/C:/hybris/bin/ext-commerce/solrfacetsearch/lib/commons-codec-1.7.jar de.hybris.bootstrap.loader.PlatformInPlaceClassLoader@606e76b4 jar commons-codec-1.7.jar (4) file:/C:/hybris/bin/custom/translation/lib/commons-codec-1.7.jar de.hybris.bootstrap.loader.PlatformInPlaceClassLoader@606e76b4 jar

does this mean that the classloader is parent first? Does the platform jar load and takes precedence over the other copies (meaning that the other copies are still present, but never used) or does the classloader find multiple, but only loaded/uses that from the platform?

In the greater scope of my concerns and desire to understand, what if two different web applications (within hybris suite) use different versions of a jar dependency, will each operate completely contained within their own and no worries about the possibility of jar being loaded from the other? Example: WebApp1 - uses jardependency-1.0.jar WebApp2 - uses jardependency-1.2.jar

...will WebApp1 run with 1.0 and WebApp2 run with 1.2 (no fear of either App1 or App2 using the other's dependency version?

If this is the default behavior of Hybris' classloader, then great! Though I'm worried that if different versions are used, they could be improperly utilized when not intended. Conversely, why load two copies of the same version jar (or that simply not happening)?