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();|
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.