Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-4210

Context Classloader prevents portlets from being correctly registered ( tomcat 6.0.18 <=, upgrading to 6.0.19+)


    • Bug
    • Status: Closed
    • Resolution: Won't Fix
    • None
    • None
    • Core Infrastructure
    • None
    • *Tomcat 6.0.19 if you use struts reproduce

      For upgrade environment:
      * Base is Tomcat 6.0.18 or before
      * Upgrading to 6.0.20 or higher
    • 3
    • Accept


      NOTE: Two methods to reproduce same error

      Upgrade reproduce:
      "I'm encountering some problem while migrating from Tomcat 6.0.18 to Tomcat 6.0.20 and later.

      My portal (Liferay 5.2.3) comes with several portlets in separated WARs. Each WAR contains a context.xml file in META-INF and each context file contains :

      <Loader loaderClass="com.liferay.support.tomcat.loader.PortalClassLoader" />

      At the first startup with Tomcat 6.0.18, no problem. No problem either at second and next Tomcat startups.

      At the first startup with Tomcat 6.0.20 (and later), each context file is copied inside $CATALINA_HOME/conf/Catalina/localhost (there were no copy with Tomcat 6.0.18). No problem for this first startup.
      But, for the next startups, the files in $CATALINA_HOME/conf/Catalina/localhost prevent my portlets to be correctly registered. I get these errors for each WAR :"

      "Struts portlet" reproduce:

      • Deploy sample-struts-liferay-portlet.war to tomcat 6.0.19 or later.
      • Wait for the tomcat started successfully, then restart Tomcat.
      • This error will occur:
        Jul 21, 2009 3:00:02 PM org.apache.coyote.http11.Http11Protocol init
        INFO: Initializing Coyote HTTP/1.1 on http-8080
        Jul 21, 2009 3:00:02 PM org.apache.catalina.startup.Catalina load
        INFO: Initialization processed in 830 ms
        Jul 21, 2009 3:00:02 PM org.apache.catalina.core.StandardService start
        INFO: Starting service Catalina
        Jul 21, 2009 3:00:02 PM org.apache.catalina.core.StandardEngine start
        INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
        Jul 21, 2009 3:00:02 PM com.liferay.portal.kernel.log.Jdk14LogImpl error
        SEVERE: Portal class loader is not available to override the default Catalina web class loader
        Jul 21, 2009 3:00:02 PM org.apache.catalina.core.StandardContext start
        SEVERE: Error listenerStart
        Jul 21, 2009 3:00:02 PM org.apache.catalina.core.StandardContext start
        SEVERE: Context [/sample-struts-liferay-portlet] startup failed due to previous errors
        Loading jar:file:/G:/apache-tomcat-6.0.20/webapps/ROOT/WEB-INF/lib/portal-impl.j
        Loading jar:file:/G:/apache-tomcat-6.0.20/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
        Loading file:/G:/apache-tomcat-6.0.20/webapps/ROOT/WEB-INF/classes/portal-ext.properties

      According to https://issues.apache.org/bugzilla/show_bug.cgi?id=42747 , META/context.xml is copied and renamed to $CATALINA_BASE/conf/[EngineName]/[HostName]/webapp.xml . So that Tomcat will look at the webapp.xml before load ROOT. Therefore PortalClassLoaderUtil.setClassLoader() is not called before PortalClassLoaderUtil.getClassLoader(). Therefore PortalClassLoaderUtil.getClassLoader() always returns null.




            support-lep@liferay.com SE Support
            bangnk Bang Nguyen (Inactive)
            Kiyoshi Lee Kiyoshi Lee
            2 Vote for this issue
            11 Start watching this issue


              6 years, 48 weeks, 3 days ago


                Version Package