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