myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Gonzalez <adr_gonza...@yahoo.fr>
Subject CODI ViewAccessScoped issue with EAR on JBoss 7.1.x
Date Tue, 19 Mar 2013 15:34:44 GMT
Hello, 

This is a follow up on http://mail-archives.apache.org/mod_mbox/myfaces-users/201212.mbox/%3C1354617133.46780.YahooMailNeo@web172404.mail.ir2.yahoo.com%3E.

@ViewAccessScoped is not working when deploying an EAR on JBoss 7.1.0 (tested it with 7.1.3
same result).
If I deploy only a war, it works.
Sample project is here [1].

I used the debugguer and found that when using and EAR :
 * the classloader obtained in PhaseListenerExtension#addPhaseListener is the EAR classloader
    ModuleClassLoader for Module "deployment.viewaccessscoped-ear.ear:main" from Service
Module Loader
 * the classloader obtained in consumePhaseListeners#consumePhaseListeners() is the WAR classloader
    ModuleClassLoader for Module "deployment.viewaccessscoped-ear.ear.viewaccessscoped-web.war:main"
from Service Module Loader

This means that phaselisteners annotated with @JsfPhaseListener are not executed.

The following phaselisteners are not registered with the war classloader when using an EAR
:
 * class org.apache.myfaces.extensions.cdi.jsf.impl.config.view.PhasesLifecycleCallbackPhaseListener
 * class org.apache.myfaces.extensions.cdi.jsf.impl.listener.phase.JsfRequestLifecyclePhaseListener

Thanks for the help !

[1] Sample project here : https://github.com/gonzalad/codi-ear-viewaccessscoped
To reproduce it, 
1. Testing the war
   a. add the war on JBoss
   b. http://localhost:8080/viewaccessscoped-web/test.faces
      you'll see on sysout that CODI ViewAccessScoped bean has been instantiated
      16:24:52,778 INFO  [stdout] (http--0.0.0.0-8080-1) @PostConstruct
   c. click on first link.
      you should see nothing on sysout (this means the previous bean instance is reused)
1. Testing the ear - incorrect behaviour
   a. add the ear on JBoss (remove the previous war)
   b. http://localhost:8080/viewaccessscoped-web/test.faces
      you'll see on sysout that CODI ViewAccessScoped bean has been instantiated
      16:22:49,186 INFO  [stdout] (http--0.0.0.0-8080-1) @PostConstruct
   c. click on first link.
      you'll see on sysout that previous CODI ViewAccessScoped instance has been destroyed
and a new one is created.
      16:23:24,389 INFO  [stdout] (http--0.0.0.0-8080-1) @PreDestroy
      16:23:24,389 INFO  [stdout] (http--0.0.0.0-8080-1) @PostConstruct


Mime
View raw message