5 Replies Latest reply on Nov 15, 2011 10:40 AM by maggus

    Portletbridge not usable on a per portlet base

    maggus

      Hi,

       

      today I updated our portlets from PortletBridge 1.0 to 2.2.0-FINAL.

       

      In the past we were used to bundle the PortletBridge into each WAR-Archive (so we release the portlets with their corresponding portlet bridge).

      When rendering a Portal-Page with the new PortletBridge 2.2.0-FINAL, the bridge was unable to find a BridgeStrategy

      ( in my case org.jboss.portletbridge.richfaces.RichFacesStrategy). This leads to an BridgeException.

       

      I downloaded the source of the Bridge and started the debugger. The Bridge uses the ClassLoader of the Portal to find the RichFacesStrategy and since our portal doesn't provide the bridge-impl/api he is not able to find the class.

       

      Is the classloading modified in this way by design?

      Why does the classloader not use the loader of the portlet's webapp?

      Is the new PortletBridge not meant to be shipped with a Portlet in a WAR-File?

       

      I found the following comment in the BridgeStrategy.class:



      // use contextClassLoader to load strategies, because when bridge-impl.jar is


      // shared classes visible by application would be different.


      ClassLoader loader = Thread.currentThread().getContextClassLoader();

       

       

      Java 1.6

      Liferay 5.2.3

       

      Regards,

      Markus

        • 1. Re: Portletbridge not usable on a per portlet base
          kenfinni

          Markus,

           

          PortletBridge is meant to be included within the WEB-INF/lib of a Portlet WAR, and this has been tested on GateIn.

           

          I don't believe it would be the ClassLoader of the Portal, but rather the Portlet Container, which should be the same as the Servlet Container.

           

          Ken

          • 2. Re: Portletbridge not usable on a per portlet base
            wesleyhales

            Also, org.jboss.portletbridge.richfaces.RichFacesStrategy will not be loaded if the RichFaces jars are not included in the war as well. Same goes for Seam.

            • 3. Re: Portletbridge not usable on a per portlet base
              maggus

              Thank you for your reply!

               

              enclosed you can find the information which the debugger gave me.

               

              it looks like the classloader which is used is based on the folder C:\DevelopTools\Liferay\liferay-apache-tomcat-6.0.18\webapps\portal\WEB-INF\classes.

               

              this folder is the place where the portal itself resides. the classloader will not find the portlet-bridge (and it's strategy) on this path... I wonder why this is not the webapp classloader of the portlet webapp...

               

              I get a class-not-found exception from the portlet bridge... the error only happens when having more than one portlet on the portlet page.

               

              the portlet WAR contains the portlet bridge and richfaces in its WEB-INF/lib dir.

               

               

              Markus

               

              bridge2_loader.png

               

              bridge2_eclipse.png

              • 4. Re: Portletbridge not usable on a per portlet base
                kenfinni

                That folder is simply a path that is accessible to the ClassLoader.

                 

                What would be more interesting is the list of jarFiles that it has available to search for the class.

                • 5. Re: Portletbridge not usable on a per portlet base
                  maggus

                  after restarting the server several times, it seems to work now. don't know why...