What I was expecting is that you would see two copies of *your* phase listener in that list. At the very least, you should see *one*, otherwise you wouldn't be getting any callbacks at all!

The phase listeners you list below are normal, and won't be making callbacks to your code.

Just FYI, JSF implementations are required to look for all occurrences of META-INF/faces-config.xml in the classpath and process them all on startup. A faces-config file can provide a list of phase-listeners to be regisered on startup; if you look inside the tomahawk jarfile you will find a faces-config.xml file that defines these two listeners. To repeat, though, these are nothing to do with your problem.

Regards,

Simon

A.McCall wrote:
Simon,

    I did what you said.  You are absolutely right...I do have 2
listeners...
     1. org.apache.myfaces.renderkit.html.util.ExtensionsPhaseListener
     2. org.apache.myfaces.renderkit.html.util.AutoScrollPhaseListener

I do not see where these listeners are configured.
Do you know how I set it up so I just have one listener?

Thanks.


Simon Kitching-3 wrote:
A.McCall wrote:
I am having the same problem. My phaselistener is being called twice, I
do not have configs entry in my web.xml, so it's not that.

Just wondering....  Did you ever find out why yours was being called
twice.
Phase listeners work fine for me. I'd be willing to bet that you do have the phase listener registered twice.

I suggest that in your phase listener you get the list of registered listeners then iterate through this and check that there is only one object whose class is your custom listener class.

LifecycleFactory factory = (LifecycleFactory)
    FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);

Lifecycle lc =  factory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);

PhaseListener[] listeners = lc.getPhaseListeners();

If it is registered twice, then you could put a logging statement in your phase-listener's constructor that prints out the current stack trace; that will show you where the instances are being created.

Regards,

Simon




Reply via email to