Portlets based on JSF and CDI throws "javax.faces.FacesException: Must call associate() before calling activate()" either during deployment (in case of RF Showcase) or during initialization of page with the portlet (cdi-jsf-portlet from quickstarts). Full exception stack can be found here http://pastebin.com/1itEpby2
Side note, when I did my own build of https://github.com/jpkrohling/gatein-portal/tree/BZ1075588-CdiBug few days ago in order to check the fix of https://bugzilla.redhat.com/show_bug.cgi?id=1075588, everything worked fine so I wonder what happened during this build.
I've tested with building on top of EAP 6.1.1.GA and with the DR6, and it seems that the problem indeed is on DR6, as the sample works with GateIn built on top of 6.1.1.GA. I'll contact the Weld responsible for EAP, to check if they are aware of this issue (as I couldn't find a relevant BZ for it).
After talking with jharting, I've run a git bisect to see when was this change introduced. I've also run a couple of experiments, to see how it affects EAP. Basically, building on top of EAP 6.1.1.GA doesn't causes this problem, but on top of EAP 6.2.0 does, as well as EAP 6.3.0.DRx. And this is the result of the bisect: a7582f78503ee563535d21d1d07a1e77e3834f71 is the first bad commit commit a7582f78503ee563535d21d1d07a1e77e3834f71 Author: Marko Luksa <marko.luksa> Date: Tue Jun 11 16:45:08 2013 +0200 WELD-1415 Cross-context forward/include call from another web app breaks HttpRequestContext cleanup (cherry picked from commit a4b40c0) :040000 040000 dd4aafd316f09dc12a6dfbf58e9cdf94e9f7d882 152572488c7eecb645e406fdd4a6d88b71de43a2 M impl :040000 040000 06ac5b7e05b9afc1a0ca7ecbe3ef9c8278174e65 b55f41f469bd1406917429ffffa794d0aab79e09 M tests-arquillian
As per jharting, the workaround is to add a context parameter called "org.jboss.weld.context.ignore.include", set to false. I've confirmed that the sample works after adding this. <context-param> <param-name>org.jboss.weld.context.ignore.include</param-name> <param-value>false</param-value> </context-param>
By the way, this option is available in Weld 1.1.18.Final, which is one version ahead of the one being used in DR6. So, manually patching EAP/Portal with this weld-core version is required.
I confirm that CDI portlets really works if you patch JPP with Weld 1.1.18.Final and add the context-param (tested on cdi-jsf-portlet from quickstarts).
Please provide a reproducer.
I have already provided a reproducer to Jozef via email.
I confirm that this issue has been fixed in ER02.