My Quotes

When U were born , you cried and the world rejoiced
Live U'r life in such a way that when you go

Tuesday, July 26, 2011

Shared libraries with Tomcat 6

    Now that we have removed the WEB-INF\LIB folders your WAR files will not have them . So when you deploy the code into Tomcat, Tomcat will complain while deploying that these libs are not found (ClassNoutFoundException).
    In order to prevent this, you can create the shared libs in Tomcat also.
    The most preferred way is to put all the jar files into the location commonly used within a Tomcat 6 installation for shared code is$CATALINA_HOME/lib. JAR files placed here are visible both to web applications and internal Tomcat code.
    This is because Tomcat 6.0 does not have any directory where we can put third-party jars (like our “<$pserver>/server/lib/ext” directory).
    But there is the other way if you do not want to share this with Tomcat.
    <<Tomcat Home>>\conf\
    Look for the property
    change this to
    shared.loader=<<your library folder>>\*.jar
    prior to this version of Tomcat, external/third party jar could be placed inside following locations:
    1) ${catalina.base}/shared/lib/ – jar needs to be shared by all the deployed applications only(to share classes across all web applications)
    2)${catalina.base}/common/lib/ – jar need to be shared by web server and applications.