Hello all,
I am a
java newbie and need your help in understanding the common loader in
tomcat. Please pardon me if I have created a duplicate topic/thread, I am new to the community.
Here is my issue:
I have class called PortletTitelComparator that is present in two jar's(ext-service.jar and portal-service.jar), the first jar((portal-service.jar) has method with 2 parameters and the other (ext-service.jar) has it with 3 parameters. I have made both these jar's available under tomcat/common/lib/ext/
my common loader in tomcat/conf/catalina.properties is defined as below:
Trail 1)common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar,${catalina.home}/common/lib/ext/*.jar (or)
Trail2)common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar,${catalina.home}/common/lib/ext/*.jar,${catalina.home}/common/lib/ext/ext-service.jar
I run into issue when one of my
jsp that uses the ext-service.jar (the method defined here with3 parameters) try to compile , i see the following error, even though the jar is in my common loader path. There is a difficulty for the container to know which one has to be picked up. For some reason it never goes to the actual jar that has this class.
The constructor PortletTitleComparator(ServletContext, Locale, Hashtable) is undefined
But when I tweak my common loader as below:
Success 1) common.loader=${catalina.home}/common/classes,${catalina.home}/common/lib/ext/ext-service.jar,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar,${catalina.home}/common/lib/ext/*.jar
things start working as expected and the jsp gets compiled. The container can now distinguish the difference between both classes.
All that was done is to have the jar mentioned out explicitly in the common loader path before ${catalina.home}/common/lib/*
I am a bit confused here and would like to know what is happening and how does a tomcat class loader behaves and on what criteria does it load its classes when 2 jars have a similar class that exhibit method overloading. Even when i had the specific jar written (see trail-2 above) at the end of the common load path it seemed it did get picked correctly.
I would be happy if some one can explain what exactly is going on here.
Thanks in advance for any one who can spare a bit of there time and explain.
alex
I have gone thru:http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html {but did not find the answer that i am looking for } the reason i am looking at tomcat 5.5 is I am working on tomcat 5.5.