Support Article
All the phase listeners (Custom & OOTB) getting registered twice
SA-2126
Summary
Issue: All the phase listeners (Custom and OOTB) are getting registered twice in CFS6.8.
Current Implementation: On using trinidad 1.2.13 and myfaces 1.2.9 along with Sun RI 1.2 as JSP and JSF Implementation in websphere. It is observed that javax.faces.event.PhaseListener, earlier was present only in MyFaces jar but now it is coming with
j2ee.jar and com.ibm.ws.webservices.thinclient_8.5.0
Current Jars in Advisor\WebContent\WEB-INF\lib
1. myfaces-api-1.2.9
2. myfaces-impl-1.2.9
3. trinidad-api-1.2.13
4. trinidad-impl-1.2.13
Working in Previous Version: Phase Listeners were getting registered only once.
Error Messages
Phaselisteners registered twice
Steps to Reproduce
>> We had seen that javax.faces.event.PhaseListener, earlier was present only in MyFaces jar but now it is coming with
j2ee.jar and com.ibm.ws.webservices.thinclient_8.5.0
Root Cause
The root cause of this problem is in a third-party product integrated with Foundation Server. MyFaces jar is responsible for invoking phase listener twice. It is observed that javax.faces.event.PhaseListener, earlier was present only in MyFaces jar but now it is coming with j2ee.jar and com.ibm.ws.webservices.thinclient_8.5.0
Resolution
Suggested to use Shared library approach. This helps to invoke phase listeners once.
IBM suggests to use Shared library approach to use third party Myfaces implementation that is not shipped with WAS.
http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/tweb_jsf.html?cp=SSAW57_8.5.5%2F3-14-2-33-0-2-3&lang=en
Engineering has carried out below tests and found FS6.8 is working without any issues.
Advisor delegation mode | Shared Library | Isolated Shared Library | Shared Library References | Comments |
PARENT_LAST | No | No | None | Jars are picked form Advisor/WEB-INF/lib |
PARENT_FIRST | Yes | No | Yes (Advisor) | Jars are picked form Advisor/WEB-INF/lib |
PARENT_FIRST | No | Yes | Yes (Advisor) | Jars are picked form OptionalLibraries/Apache/Myfaces |
PARENT_FIRST | No | Yes | Yes (ChordiantEAR, Advisor, other applications or modules) | Jars are picked form OptionalLibraries/Apache/Myfaces |
It is observed that above approaches work in OOTB wherein the phase listeners are getting registered only once and links or buttons works with actionListener.
Interim Custom Fix changes is used by the developers as local change: FacesConfigurator in myfaces-impl-1.2.9.jar is overridden. Here, restricted the My Faces life cycle to add phase listener in FacesConfigurator.configureLifecycle().
As per support review the interim fix does not seem to be appropriate and OOTB functionality (using JSF) does not work giving java.lang.NoSuchMethodError: org/apache/myfaces/config/FacesConfigurator.update()V.
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.