I want to implement a custom PhaseListener in my faces-config.xml like it is suggested at stack overflow. So this is my faces-config.xml:


And this is MyPhaseListener-Dummy:

public class MyPhaseListener implements PhaseListener {

    public PhaseId getPhaseId() {
        return PhaseId.RENDER_RESPONSE;

    public void beforePhase(PhaseEvent event) {
        // Do your job here which should run right before the RENDER_RESPONSE.

    public void afterPhase(PhaseEvent event) {
        // Do your job here which should run right after the RENDER_RESPONSE.


But this approach leads the application server to crash:

HTTP Status 500 - serialFactory

type Exception report

message serialFactory

description The server encountered an internal error that prevented it from fulfilling this request.


javax.servlet.ServletException: serialFactory

So how is it possible to implement a custom PhaseListener?

asked 22.11.2013 at 16:31

Nikel%20Weis's gravatar image

Nikel Weis
accept rate: 57%

edited 22.11.2013 at 16:32


Hi Nikel,

I suppose this error appears at the start of your app? Have you exported your Phaselistener-Class in to a jar File? The application can only interpret compiled class files if you declare them in the xml file. So you have to export your package and insert the jar file into the lib-folder.

(28.11.2013 at 09:52) Raphael Bürgin Raphael%20B%C3%BCrgin's gravatar image

@Raphael: Thanks for the push into the right direction! The application does not crash at startup anymore.

(28.11.2013 at 10:41) Nikel Weis Nikel%20Weis's gravatar image

As Raphael Bürgin pointed out it is necessary to compile the class as jar file and place it in the lib-Folder. The syntax remains the same as in the initial question and the file should be named like the class - so it would be MyPhaseListener.jar (although the name is not best practice).


answered 28.11.2013 at 10:42

Nikel%20Weis's gravatar image

Nikel Weis
accept rate: 57%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 22.11.2013 at 16:31

Seen: 7,986 times

Last updated: 28.11.2013 at 10:42