Test:

1.0.6 SNAPSHOT, CODI @Advanced *and* BeanManagerProvider to inject bean in
@FacesConverter

Test result:

1. CDI bean is injected successfully in @FacesConverter, as expected, and
converter provides data to JSF component on xhtml (same for previous test)

2. This breaks PrimeFaces p:pickList p:ajax event="transfer" (PrimeFaces Issue
4908 <http://code.google.com/p/primefaces/issues/detail?id=4908>).

Stacktrace below:

java.lang.NullPointerException
        at 
jsf.role.pf_RoleController$RoleControllerConverter.getAsObject(pf_RoleController.java:678)
        at 
org.primefaces.component.picklist.PickList.populateModel(PickList.java:425)
        at 
org.primefaces.component.picklist.PickList.queueEvent(PickList.java:401)
        at 
org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.decode(AjaxBehaviorRenderer.java:42)
        at 
javax.faces.component.behavior.ClientBehaviorBase.decode(ClientBehaviorBase.java:64)
        at 
org.primefaces.renderkit.CoreRenderer.decodeBehaviors(CoreRenderer.java:377)
        at 
org.primefaces.component.picklist.PickListRenderer.decode(PickListRenderer.java:50)
        at 
javax.faces.component.UIComponentBase.decode(UIComponentBase.java:467)
        at javax.faces.component.UIInput.decode(UIInput.java:352)
        at 
javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1377)
        at javax.faces.component.UIInput.processDecodes(UIInput.java:188)
        at 
org.apache.myfaces.context.servlet.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:731)
        at 
org.apache.myfaces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:214)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:932)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at org.primefaces.component.tabview.TabView.visitTree(TabView.java:409)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIForm.visitTree(UIForm.java:354)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
        at 
javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
        at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialExecute(PartialViewContextImpl.java:420)
        at 
org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:401)
        at 
javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:88)
        at 
javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:88)
        at 
javax.faces.component.UIViewRoot$ApplyRequestValuesPhaseProcessor.process(UIViewRoot.java:1488)
        at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1372)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:759)
        at 
org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:38)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
        at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at 
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at 
org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:148)
        at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at pf.LoginFilter.doFilter(LoginFilter.java:175)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
        at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
        at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)



On Wed, Nov 21, 2012 at 5:42 AM, Howard W. Smith, Jr. <
smithh032...@gmail.com> wrote:

> Gerhard/Mark,
>
> I just tested 1.0.6 SNAPSHOT of MyFaces CODI and injected bean in
> @FacesConverter via CODI @Advanced and @Inject as demonstrated in [2]
> below. It is evident that CODI @Advanced and @Inject is successfully
> injecting bean in the @FacesConverter, but this breaks PrimeFaces
> p:pickList p:ajax event="transfer" as I noted earlier, Issue 
> 4908<http://code.google.com/p/primefaces/issues/detail?id=4908>in PrimeFaces 
> Issue Tracker.
>
> Next, I will attempt to test the fix for [1] EXTCDI-302 and use Mark's
> earlier suggestion, CODI  BeanManagerProvider.getInstance().
> getContextualReference(YourClass.class). Next reply will contain test
> results.
>
> [1] https://issues.apache.org/jira/browse/EXTCDI-302
> [2] http://people.apache.org/~gpetracek/myfaces/codi/demos/
>
> Below is stacktrace from the CODI @Advanced test that I mentioned above.
> This is related to PrimeFaces Issue 4908 above.
>
> java.lang.NullPointerException
>       at jsf.role.pf_RoleController.access$000(pf_RoleController.java:45)
>       at 
> jsf.role.pf_RoleController$RoleControllerConverter.getAsObject(pf_RoleController.java:678)
>       at 
> org.primefaces.component.picklist.PickList.populateModel(PickList.java:425)
>       at 
> org.primefaces.component.picklist.PickList.queueEvent(PickList.java:401)
>       at 
> org.primefaces.component.behavior.ajax.AjaxBehaviorRenderer.decode(AjaxBehaviorRenderer.java:42)
>       at 
> javax.faces.component.behavior.ClientBehaviorBase.decode(ClientBehaviorBase.java:64)
>       at 
> org.primefaces.renderkit.CoreRenderer.decodeBehaviors(CoreRenderer.java:377)
>       at 
> org.primefaces.component.picklist.PickListRenderer.decode(PickListRenderer.java:50)
>       at 
> javax.faces.component.UIComponentBase.decode(UIComponentBase.java:467)
>       at javax.faces.component.UIInput.decode(UIInput.java:352)
>       at 
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1377)
>       at javax.faces.component.UIInput.processDecodes(UIInput.java:188)
>       at 
> org.apache.myfaces.context.servlet.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:731)
>       at 
> org.apache.myfaces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:214)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:932)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at org.primefaces.component.tabview.TabView.visitTree(TabView.java:409)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIForm.visitTree(UIForm.java:354)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at javax.faces.component.UIComponent.visitTree(UIComponent.java:960)
>       at 
> javax.faces.component.UIComponentBase.visitTree(UIComponentBase.java:1165)
>       at 
> org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartialExecute(PartialViewContextImpl.java:420)
>       at 
> org.apache.myfaces.context.servlet.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:401)
>       at 
> javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:88)
>       at 
> javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:88)
>       at 
> javax.faces.component.UIViewRoot$ApplyRequestValuesPhaseProcessor.process(UIViewRoot.java:1488)
>       at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1372)
>       at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:759)
>       at 
> org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:38)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
>       at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
>       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>       at 
> org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>       at 
> org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:148)
>       at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>       at pf.LoginFilter.doFilter(LoginFilter.java:175)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>       at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>       at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>       at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>       at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
>       at 
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>       at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
>       at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>       at 
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
>       at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>       at 
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
>       at 
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
>       at 
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>       at java.lang.Thread.run(Thread.java:722)
>
>
> On Wed, Nov 21, 2012 at 5:11 AM, Gerhard Petracek <
> gerhard.petra...@gmail.com> wrote:
>
>> the jsf2 module of codi is tested with jsf 2.0.x and 2.1.x
>>
>> regards,
>> gerhard
>>
>> http://www.irian.at
>>
>> Your JSF/JavaEE powerhouse -
>> JavaEE Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>>
>>
>> 2012/11/21 Howard W. Smith, Jr. <smithh032...@gmail.com>
>>
>> > Gerhard,
>> >
>> > I definitely prefer [1] (JAR download), thanks.
>> >
>> > Interesting...I must have been multitasking big time while migrating to
>> > TomEE/CDI, because I downloaded jsf1.2 1.0.5 version of CODI; that's the
>> > filename of the JAR I downloaded.
>> >
>> > This 1.0.6 SNAPSHOT that is now available, is this jsf1.2 or jsf2.0? I
>> > hope jsf2.0, since my app has been jsf2.1 ever since the start (a little
>> > over 1 year ago).
>> >
>> > Thanks,
>> >  Howard
>> >
>> >
>> > On Wed, Nov 21, 2012 at 4:40 AM, Gerhard Petracek <
>> > gerhard.petra...@gmail.com> wrote:
>> >
>> >> hi howard,
>> >>
>> >> #1:
>> >> i've updated the ticket - thx!
>> >>
>> >> #2:
>> >> via maven (to update a local snapshot build your application with
>> >> the maven-parameter -U)
>> >> or
>> >> download it from [1]
>> >> or
>> >> checkout codi and build it locally (see the description in the wiki)
>> >>
>> >> regards,
>> >> gerhard
>> >>
>> >> [1]
>> >>
>> https://repository.apache.org/content/groups/snapshots/org/apache/myfaces/extensions/cdi/
>> >>
>> >> http://www.irian.at
>> >>
>> >> Your JSF/JavaEE powerhouse -
>> >> JavaEE Consulting, Development and
>> >> Courses in English and German
>> >>
>> >> Professional Support for Apache MyFaces
>> >>
>> >>
>> >>
>> >> 2012/11/21 Howard W. Smith, Jr. <smithh032...@gmail.com>
>> >>
>> >>> Gerhard,
>> >>>
>> >>> I just registered with username that matches username of my email
>> >>> address (above).
>> >>>
>> >>> Hmmm, now I need to find out how I can get the latest snapshot. Can I
>> >>> locate on Maven Central repository?
>> >>>
>> >>> Thanks,
>> >>> Howard
>> >>>
>> >>>
>> >>> On Wed, Nov 21, 2012 at 4:13 AM, Gerhard Petracek <
>> >>> gerhard.petra...@gmail.com> wrote:
>> >>>
>> >>>> hi howard,
>> >>>>
>> >>>> yes - i've fixed EXTCDI-302 already -> if you like, you can test it
>> >>>> with the current snapshot (just ensure that you have the latest
>> snapshot).
>> >>>> if you have an apache-jira account, i'll update the ticket so that
>> you
>> >>>> are listed as the reporter of it.
>> >>>>
>> >>>> regards,
>> >>>> gerhard
>> >>>>
>> >>>> http://www.irian.at
>> >>>>
>> >>>> Your JSF/JavaEE powerhouse -
>> >>>> JavaEE Consulting, Development and
>> >>>> Courses in English and German
>> >>>>
>> >>>> Professional Support for Apache MyFaces
>> >>>>
>> >>>>
>> >>>> 2012/11/21 Howard W. Smith, Jr. <smithh032...@gmail.com>
>> >>>>
>> >>>> Gerhard,
>> >>>>>
>> >>>>> Interesting.
>> >>>>>
>> >>>>>
>> >>>>>    - MyFaces CODI <https://issues.apache.org/jira/browse/EXTCDI>
>> >>>>>    - EXTCDI-302 <https://issues.apache.org/jira/browse/EXTCDI-302>
>> >>>>>
>> >>>>>
>> >>>>> is a new issue that you just created and resolved per this email I
>> >>>>> just sent? :)
>> >>>>>
>> >>>>> Thanks,
>> >>>>> Howard
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On Wed, Nov 21, 2012 at 2:55 AM, Gerhard Petracek <
>> >>>>> gerhard.petra...@gmail.com> wrote:
>> >>>>>
>> >>>>>> please have a look at [1] and [2].
>> >>>>>>
>> >>>>>> regards,
>> >>>>>> gerhard
>> >>>>>>
>> >>>>>> [1] https://issues.apache.org/jira/browse/EXTCDI-302
>> >>>>>> [2] http://people.apache.org/~gpetracek/myfaces/codi/demos/
>> >>>>>>
>> >>>>>> http://www.irian.at
>> >>>>>>
>> >>>>>> Your JSF/JavaEE powerhouse -
>> >>>>>> JavaEE Consulting, Development and
>> >>>>>> Courses in English and German
>> >>>>>>
>> >>>>>> Professional Support for Apache MyFaces
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> 2012/11/20 Mark Struberg <strub...@yahoo.de>
>> >>>>>>
>> >>>>>>> CDI injection using @Advanced should work perfectly fine. We
>> tested
>> >>>>>>> this excessively and use it on several containers in production.
>> >>>>>>>
>> >>>>>>> I'm curious why it doesn't work for you.
>> >>>>>>>
>> >>>>>>> LieGrue,
>> >>>>>>> strub
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> ----- Original Message -----
>> >>>>>>> > From: "Howard W. Smith, Jr." <smithh032...@gmail.com>
>> >>>>>>> > To: MyFaces Discussion <users@myfaces.apache.org>; Rafael
>> Pestano
>> >>>>>>> <rmpest...@yahoo.com.br>
>> >>>>>>> > Cc:
>> >>>>>>> > Sent: Tuesday, November 20, 2012 3:13 PM
>> >>>>>>> > Subject: Re: Migrating to CDI: injecting stateless/facade in
>> >>>>>>> Converter via facescontext
>> >>>>>>> >
>> >>>>>>> > Rafael,
>> >>>>>>> >
>> >>>>>>> > I saw that page about CODI @Advanced. :)
>> >>>>>>> >
>> >>>>>>> > I tried CODI @Advanced, but CDI managed bean was not injected
>> voa
>> >>>>>>> @Inject,
>> >>>>>>> > and then I tried to inject Stateless EJB via @Inject, and that
>> >>>>>>> stateless
>> >>>>>>> > EJB was not injected either.
>> >>>>>>> >
>> >>>>>>> > Thanks,
>> >>>>>>> > Howard
>> >>>>>>> >
>> >>>>>>> > On Tue, Nov 20, 2012 at 9:02 AM, Rafael Pestano
>> >>>>>>> > <rmpest...@yahoo.com.br>wrote:
>> >>>>>>> >
>> >>>>>>> >>  you can also use CODI @Advanced and then inject "anything" in
>> the
>> >>>>>>> >>  converter, see [1].
>> >>>>>>> >>
>> >>>>>>> >>  i hope it helps.
>> >>>>>>> >>
>> >>>>>>> >>  [1]:
>> >>>>>>> >>
>> >>>>>>>
>> https://cwiki.apache.org/EXTCDI/jsf-usage.html#JSFUsage-DependencyInjection
>> >>>>>>> >>
>> >>>>>>> >>
>> >>>>>>> >>  Att,
>> >>>>>>> >>
>> >>>>>>> >>  Rafael M. Pestano
>> >>>>>>> >>
>> >>>>>>> >>  Desenvolvedor Java Cia. de Processamento de Dados do Rio
>> Grande
>> >>>>>>> do Sul
>> >>>>>>> >>  Graduando em Ciência da Computação UFRGS
>> >>>>>>> >>  http://conventionsframework.org
>> >>>>>>> >>
>> >>>>>>> >>  http://rpestano.wordpress.com/
>> >>>>>>> >>  @realpestano
>> >>>>>>> >>
>> >>>>>>> >>
>> >>>>>>> >>  ________________________________
>> >>>>>>> >>   De: "Howard W. Smith, Jr." <smithh032...@gmail.com>
>> >>>>>>> >>  Para: Mark Struberg <strub...@yahoo.de>; MyFaces Discussion <
>> >>>>>>> >>  users@myfaces.apache.org>
>> >>>>>>> >>  Cc: "us...@openejb.apache.org" <us...@openejb.apache.org>
>> >>>>>>> >>  Enviadas: Terça-feira, 20 de Novembro de 2012 11:37
>> >>>>>>> >>  Assunto: Re: Migrating to CDI: injecting stateless/facade in
>> >>>>>>> Converter via
>> >>>>>>> >>  facescontext
>> >>>>>>> >>
>> >>>>>>> >>  Interesting and noted, thanks. Yes, I did hear JSF 2.2 will
>> >>>>>>> allow CDI in
>> >>>>>>> >>  facesconverter. Thanks.
>> >>>>>>> >>  On Nov 20, 2012 8:34 AM, "Mark Struberg"
>> >>>>>>> > <strub...@yahoo.de> wrote:
>> >>>>>>> >>
>> >>>>>>> >>  > you could also have used CODI
>> BeanManagerProvider#getReference
>> >>>>>>> to get
>> >>>>>>> >>  > access to the bean.
>> >>>>>>> >>  >
>> >>>>>>> >>  > The support you need out of the box will come in JSF-2.2.
>> >>>>>>> >>  >
>> >>>>>>> >>  >
>> >>>>>>> >>  > LieGrue,
>> >>>>>>> >>  > strub
>> >>>>>>> >>  >
>> >>>>>>> >>  >
>> >>>>>>> >>  >
>> >>>>>>> >>  > ----- Original Message -----
>> >>>>>>> >>  > > From: "Howard W. Smith, Jr."
>> >>>>>>> > <smithh032...@gmail.com>
>> >>>>>>> >>  > > To: us...@openejb.apache.org; MyFaces Discussion <
>> >>>>>>> >>  > users@myfaces.apache.org>
>> >>>>>>> >>  > > Cc:
>> >>>>>>> >>  > > Sent: Tuesday, November 20, 2012 1:56 PM
>> >>>>>>> >>  > > Subject: Re: Migrating to CDI: injecting stateless/facade
>> in
>> >>>>>>> > Converter
>> >>>>>>> >>  > via facescontext
>> >>>>>>> >>  > >
>> >>>>>>> >>  > >T he goal was to inject bean in facesconverter via CDI,
>> but I
>> >>>>>>> > don't have
>> >>>>>>> >>  > > this need anymore, since faces converter is not an
>> eligible
>> >>>>>>> > injection
>> >>>>>>> >>  > > point, so I opted to use request scoped JSF managed beans
>> >>>>>>> that
>> >>>>>>> > have
>> >>>>>>> >>  > > facesconverter defined within the bean. That's working
>> fine.
>> >>>>>>> > Thanks.
>> >>>>>>> >>  > >
>> >>>>>>> >>  > > Okay, I can cc myfaces user group as well, going forward.
>> :-)
>> >>>>>>> >>  > > On Nov 20, 2012 7:37 AM, "Romain Manni-Bucau"
>> >>>>>>> >>  > > <rmannibu...@gmail.com>
>> >>>>>>> >>  > > wrote:
>> >>>>>>> >>  > >
>> >>>>>>> >>  > >>  i'm still not clear about your goal and where you need
>> >>>>>>> > injection
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>  maybe share a (runnable) sample to show us what you are
>> >>>>>>> > talking about
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>  side note: myfaces list can help you a lot about it too
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>  *Romain Manni-Bucau*
>> >>>>>>> >>  > >>  *Twitter: @rmannibucau
>> >>>>>>> > <https://twitter.com/rmannibucau>*
>> >>>>>>> >>  > >>  *Blog: **http://rmannibucau.wordpress.com/*<
>> >>>>>>> >>  > >>  http://rmannibucau.wordpress.com/>
>> >>>>>>> >>  > >>  *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>> >>>>>>> >>  > >>  *Github: https://github.com/rmannibucau*
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>  2012/11/20 Howard W. Smith, Jr.
>> >>>>>>> > <smithh032...@gmail.com>
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >>  > Interesting, that will allow you to get instance of
>> >>>>>>> > beans, if
>> >>>>>>> >>  already
>> >>>>>>> >>  > >>  > instantiated, and that could have helped in converter,
>> >>>>>>> > only if
>> >>>>>>> >>  beans
>> >>>>>>> >>  > >>  > already injected earlier?
>> >>>>>>> >>  > >>  > On Nov 20, 2012 7:11 AM, "Romain Manni-Bucau"
>> >>>>>>> >>  > > <rmannibu...@gmail.com>
>> >>>>>>> >>  > >>  > wrote:
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>  > > was thinking to
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>>
>> http://docs.oracle.com/javaee/6/api/javax/faces/context/FacesContext.html
>> >>>>>>> >>  > >>  > > getAttributes()
>> >>>>>>> >>  > >>  > > method (depend a bit on your real need)
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > > *Romain Manni-Bucau*
>> >>>>>>> >>  > >>  > > *Twitter: @rmannibucau
>> >>>>>>> > <https://twitter.com/rmannibucau>*
>> >>>>>>> >>  > >>  > > *Blog: **http://rmannibucau.wordpress.com/*<
>> >>>>>>> >>  > >>  > > http://rmannibucau.wordpress.com/>
>> >>>>>>> >>  > >>  > > *LinkedIn:
>> >>>>>>> > **http://fr.linkedin.com/in/rmannibucau*
>> >>>>>>> >>  > >>  > > *Github: https://github.com/rmannibucau*
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > > 2012/11/20 Howard W. Smith, Jr.
>> >>>>>>> > <smithh032...@gmail.com>
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  > > > Faces context? Please explain.
>> >>>>>>> >>  > >>  > > >  On Nov 20, 2012 1:56 AM, "Romain
>> >>>>>>> > Manni-Bucau"
>> >>>>>>> >>  > > <
>> >>>>>>> >>  > >>  rmannibu...@gmail.com>
>> >>>>>>> >>  > >>  > > > wrote:
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > > > > You cant use faces context?
>> >>>>>>> >>  > >>  > > > > Le 20 nov. 2012 03:01, "Howard W.
>> >>>>>>> > Smith, Jr."
>> >>>>>>> >>  > > <
>> >>>>>>> >>  > >>  > smithh032...@gmail.com>
>> >>>>>>> >>  > >>  > > a
>> >>>>>>> >>  > >>  > > > > écrit :
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > > > > For minimal changes, I'm adding
>> >>>>>>> > FacesConverter
>> >>>>>>> >>  > > to JSF
>> >>>>>>> >>  > >>  requestscoped
>> >>>>>>> >>  > >>  > > > > > managedBean's as per the
>> >>>>>>> > Stackoverflow answer
>> >>>>>>> >>  > > below:
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > How can I inject in
>> >>>>>>> > @FacesConverter?<
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> > http://stackoverflow.com/a/13156834/933054>
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > Yes, this means more classes in the
>> >>>>>>> > project, but
>> >>>>>>> >>  > > honestly, I have
>> >>>>>>> >>  > >>  > not
>> >>>>>>> >>  > >>  > > > had
>> >>>>>>> >>  > >>  > > > > > to spend much time
>> >>>>>>> > 'maintaining' my
>> >>>>>>> >>  > > Converter classes at all. I
>> >>>>>>> >>  > >>  > just
>> >>>>>>> >>  > >>  > > > > tested
>> >>>>>>> >>  > >>  > > > > > this concept, and I'm not
>> >>>>>>> > experiencing this
>> >>>>>>> >>  > > exceptioin any more.
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > While testing the above, I see more
>> >>>>>>> > exceptions to
>> >>>>>>> >>  > > resolve related
>> >>>>>>> >>  > >>  > to
>> >>>>>>> >>  > >>  > > > > > migrating to CDI. Will let you all
>> >>>>>>> > know, if I have
>> >>>>>>> >>  > > any more
>> >>>>>>> >>  > >>  > > questions.
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > Thanks for all the responses/help,
>> >>>>>>> > so far. :)
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > On Mon, Nov 19, 2012 at 7:20 PM,
>> >>>>>>> > Romain
>> >>>>>>> >>  > > Manni-Bucau
>> >>>>>>> >>  > >>  > > > > > <rmannibu...@gmail.com>wrote:
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > > > > If it is a nested class you
>> >>>>>>> > need it otherwise
>> >>>>>>> >>  > > (class foo in
>> >>>>>>> >>  > >>  > > foo.java
>> >>>>>>> >>  > >>  > > > > > file)
>> >>>>>>> >>  > >>  > > > > > > you dont need it
>> >>>>>>> >>  > >>  > > > > > > Le 20 nov. 2012 01:16,
>> >>>>>>> > "Howard W. Smith,
>> >>>>>>> >>  > > Jr." <
>> >>>>>>> >>  > >>  > > > smithh032...@gmail.com>
>> >>>>>>> >>  > >>  > > > > a
>> >>>>>>> >>  > >>  > > > > > > écrit :
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > Good question. I removed
>> >>>>>>> >>  > > 'static', because I didn't see it in
>> >>>>>>> >>  > >>  > the
>> >>>>>>> >>  > >>  > > > > code
>> >>>>>>> >>  > >>  > > > > > at
>> >>>>>>> >>  > >>  > > > > > > > following URLs:
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> https://cwiki.apache.org/confluence/display/EXTCDI/JSF+Usage#JSFUsage-DependencyInjection
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> http://stackoverflow.com/questions/7531449/cdi-injection-into-a-facesconverter
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > > https://issues.apache.org/jira/browse/EXTCDI-127
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > On Mon, Nov 19, 2012 at
>> >>>>>>> > 4:30 PM, Romain
>> >>>>>>> >>  > > Manni-Bucau
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> > <rmannibu...@gmail.com>wrote:
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > Why removing static?
>> >>>>>>> > It means it is
>> >>>>>>> >>  > > no more manageable by
>> >>>>>>> >>  > >>  cdi
>> >>>>>>> >>  > >>  > > > (cdi
>> >>>>>>> >>  > >>  > > > > > cant
>> >>>>>>> >>  > >>  > > > > > > > do
>> >>>>>>> >>  > >>  > > > > > > > > a new on it)
>> >>>>>>> >>  > >>  > > > > > > > > Le 19 nov. 2012
>> >>>>>>> > 22:13, "Howard
>> >>>>>>> >>  > > W. Smith, Jr." <
>> >>>>>>> >>  > >>  > > > > > smithh032...@gmail.com>
>> >>>>>>> >>  > >>  > > > > > > a
>> >>>>>>> >>  > >>  > > > > > > > > écrit :
>> >>>>>>> >>  > >>  > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > @Advanced was
>> >>>>>>> > found in the
>> >>>>>>> >>  > > following:
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > import
>> >>>>>>> >>  > >>  org.apache.myfaces.extensions.cdi.core.api.Advanced;
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > After some
>> >>>>>>> > tinkering, I
>> >>>>>>> >>  > > removed 'static' from the
>> >>>>>>> >>  > >>  following
>> >>>>>>> >>  > >>  > > > > > > definition,
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > public static
>> >>>>>>> > class
>> >>>>>>> >>  > > AddressTypeControllerConverter
>> >>>>>>> >>  > >>  > implements
>> >>>>>>> >>  > >>  > > > > > > > Converter {
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > I also added
>> >>>>>>> > @Advanced to the
>> >>>>>>> >>  > > FacesConverter/Converter,
>> >>>>>>> >>  > >>  and
>> >>>>>>> >>  > >>  > > > > latest
>> >>>>>>> >>  > >>  > > > > > > > error
>> >>>>>>> >>  > >>  > > > > > > > > is
>> >>>>>>> >>  > >>  > > > > > > > > > the following:
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > Nov 19, 2012
>> >>>>>>> > 4:08:21 PM
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> > javax.faces.component._ExternalSpecifications
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> > isBeanValidationAvailable
>> >>>>>>> >>  > >>  > > > > > > > > > INFO: MyFaces
>> >>>>>>> > Bean Validation
>> >>>>>>> >>  > > support enabled
>> >>>>>>> >>  > >>  > > > > > > > > > Nov 19, 2012
>> >>>>>>> > 4:08:21 PM
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > > org.apache.myfaces.application.ApplicationImpl
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> > internalCreateConverter
>> >>>>>>> >>  > >>  > > > > > > > > > SEVERE: Could
>> >>>>>>> > not instantiate
>> >>>>>>> >>  > > converter class
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >
>> >>>>>>> >
>> jsf.address.pf_AddressTypeController$AddressTypeControllerConverter
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > > java.lang.InstantiationException:
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >
>> >>>>>>> >
>> jsf.address.pf_AddressTypeController$AddressTypeControllerConverter
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > On Mon, Nov 19,
>> >>>>>>> > 2012 at 3:07
>> >>>>>>> >>  > > PM, Howard W. Smith, Jr. <
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> > smithh032...@gmail.com>
>> >>>>>>> >>  > > wrote:
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > I searched
>> >>>>>>> > google, found
>> >>>>>>> >>  > > the following:
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > CDI
>> >>>>>>> > Injection into a
>> >>>>>>> >>  > > FacesConverter<
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> http://stackoverflow.com/questions/7531449/cdi-injection-into-a-facesconverter
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > which lead
>> >>>>>>> > me to:
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > MyFaces
>> >>>>>>> > Extensions CDI
>> >>>>>>> >>  > >>  JSF Usage > Dependency
>> >>>>>>> >>  > >>  > Injection<
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> https://cwiki.apache.org/confluence/display/EXTCDI/JSF+Usage#JSFUsage-DependencyInjection
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > but I
>> >>>>>>> > don't which
>> >>>>>>> >>  > > library to import for @Advanced.
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > If
>> >>>>>>> > @Advanced can be used
>> >>>>>>> >>  > > (since I am using CODI), then
>> >>>>>>> >>  > >>  > this
>> >>>>>>> >>  > >>  > > > > would
>> >>>>>>> >>  > >>  > > > > > > be
>> >>>>>>> >>  > >>  > > > > > > > > > great.
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > > On Mon,
>> >>>>>>> > Nov 19, 2012 at
>> >>>>>>> >>  > > 2:56 PM, Romain Manni-Bucau <
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> > rmannibu...@gmail.com
>> >>>>>>> >>  > >>  > > > > > > > > > > >
>> >>>>>>> > wrote:
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > >> Maybe
>> >>>>>>> > use
>> >>>>>>> >>  > > BeanProvider of deltaspike
>> >>>>>>> >>  > >>  > > > > > > > > > >> Le 19
>> >>>>>>> > nov. 2012
>> >>>>>>> >>  > > 20:50, "Howard W. Smith, Jr." <
>> >>>>>>> >>  > >>  > > > > > > > smithh032...@gmail.com
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > a
>> >>>>>>> >>  > >>  > > > > > > > > > >> écrit
>> >>>>>>> > :
>> >>>>>>> >>  > >>  > > > > > > > > > >>
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > Hmmm... after
>> >>>>>>> >>  > > thinking about it, I remembered to use
>> >>>>>>> >>  > >>  > > > @Inject
>> >>>>>>> >>  > >>  > > > > > on
>> >>>>>>> >>  > >>  > > > > > > > the
>> >>>>>>> >>  > >>  > > > > > > > > > bean
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > which I want to
>> >>>>>>> >>  > > inject. So, I did the following:
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > @FacesConverter(forClass = AddressType.class)
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >    public
>> >>>>>>> >>  > > static class
>> >>>>>>> >>  > >>  AddressTypeControllerConverter
>> >>>>>>> >>  > >>  > > > > > > implements
>> >>>>>>> >>  > >>  > > > > > > > > > >>
>> >>>>>>> > Converter
>> >>>>>>> >>  > >>  > > > > > > > > > >> > {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >        @Inject
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >        private
>> >>>>>>> >>  > > pf_AddressTypeController controller;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >        public
>> >>>>>>> >>  > > Object getAsObject(FacesContext
>> >>>>>>> >>  > >>  > > > facesContext,
>> >>>>>>> >>  > >>  > > > > > > > > > UIComponent
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > component,
>> >>>>>>> >>  > > String value) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >            if
>> >>>>>>> >>  > > (value == null || value.length() ==
>> >>>>>>> >>  > >>  0)
>> >>>>>>> >>  > >>  > {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > return null;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >            }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > return
>> >>>>>>> >>  > >>  > > > controller.ejbFacade.find(getKey(value));
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >        }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > but
>> >>>>>>> >>  > > 'controller' is still not being injected. I even
>> >>>>>>> >>  > >>  > > tried
>> >>>>>>> >>  > >>  > > > > the
>> >>>>>>> >>  > >>  > > > > > > > same
>> >>>>>>> >>  > >>  > > > > > > > > > for
>> >>>>>>> >>  > >>  > > > > > > > > > >> the
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > actual
>> >>>>>>> >>  > > 'ejbFacade' (which is a stateless bean), but
>> >>>>>>> >>  > >>  > > that,
>> >>>>>>> >>  > >>  > > > > too,
>> >>>>>>> >>  > >>  > > > > > > > > > resulted
>> >>>>>>> >>  > >>  > > > > > > > > > >> in
>> >>>>>>> >>  > >>  > > > > > > > > > >> > a
>> >>>>>>> >>  > > NullPointerException, which tells me that @Inject
>> >>>>>>> >>  > >>  is
>> >>>>>>> >>  > >>  > > not
>> >>>>>>> >>  > >>  > > > > > > > injecting
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > pf_AddressTypeController (@sessionscoped bean) OR
>> >>>>>>> >>  > >>  > > > ejbFacade
>> >>>>>>> >>  > >>  > > > > > > > > > (@Stateless
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > bean instance of
>> >>>>>>> >>  > > AddressTypeFacade).
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > Is there a
>> >>>>>>> >>  > > general practice used for injecting beans
>> >>>>>>> >>  > >>  > in
>> >>>>>>> >>  > >>  > > > > > > > Converters..
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > On Mon, Nov 19,
>> >>>>>>> >>  > > 2012 at 2:38 PM, Romain Manni-Bucau
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > <rmannibu...@gmail.com>wrote:
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  Can you
>> >>>>>>> >>  > > reproduce it in a sample? What is on the
>> >>>>>>> >>  > >>  npe
>> >>>>>>> >>  > >>  > > > line?
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  Le 19 nov.
>> >>>>>>> >>  > > 2012 20:25, "Howard W. Smith, Jr." <
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> > smithh032...@gmail.com>
>> >>>>>>> >>  > >>  > > > > > > > > > >> a
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  écrit :
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > I am
>> >>>>>>> >>  > > still migrating my app from JSF Managed
>> >>>>>>> >>  > >>  beans
>> >>>>>>> >>  > >>  > > to
>> >>>>>>> >>  > >>  > > > > CDI
>> >>>>>>> >>  > >>  > > > > > > > > managed
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > beans,
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  so
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > I am
>> >>>>>>> >>  > > (regression) testing, and I came across the
>> >>>>>>> >>  > >>  > > > > exception
>> >>>>>>> >>  > >>  > > > > > > > below
>> >>>>>>> >>  > >>  > > > > > > > > > >> when
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > attempting to add a record into the database on
>> >>>>>>> >>  > >>  > one
>> >>>>>>> >>  > >>  > > of
>> >>>>>>> >>  > >>  > > > > the
>> >>>>>>> >>  > >>  > > > > > > > xhtml
>> >>>>>>> >>  > >>  > > > > > > > > > >> pages.
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > Caused
>> >>>>>>> >>  > > by: java.lang.NullPointerException
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > at
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >>
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> jsf.address.pf_AddressTypeController$AddressTypeControllerConverter.getAsObject(pf_AddressTypeController.java:283)
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > The
>> >>>>>>> >>  > > exception is caused by this line below.
>> >>>>>>> >>  > >>  > > > *ejbFacade*
>> >>>>>>> >>  > >>  > > > > > is a
>> >>>>>>> >>  > >>  > > > > > > > > > >>
>> >>>>>>> > stateless
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  bean
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > injected by @Inject.
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      return
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> > controller.*ejbFacade*.find(getKey(value));
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > The
>> >>>>>>> >>  > > code below is as-is using JSF Managed Beans.
>> >>>>>>> >>  > >>  > > > Please
>> >>>>>>> >>  > >>  > > > > > > advise
>> >>>>>>> >>  > >>  > > > > > > > > on
>> >>>>>>> >>  > >>  > > > > > > > > > >> how I
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > should
>> >>>>>>> >>  > > update the following code, so it will
>> >>>>>>> >>  > >>  work
>> >>>>>>> >>  > >>  > > well
>> >>>>>>> >>  > >>  > > > > > with
>> >>>>>>> >>  > >>  > > > > > > > CDI.
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > @FacesConverter(forClass =
>> >>>>>>> >>  > >>  AddressType.class)
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > public static class
>> >>>>>>> >>  > >>  > > AddressTypeControllerConverter
>> >>>>>>> >>  > >>  > > > > > > > > implements
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  Converter
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > public Object getAsObject(FacesContext
>> >>>>>>> >>  > >>  > > > > > facesContext,
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > UIComponent
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > component, String value) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      if (value == null || value.length()
>> >>>>>>> >>  > >>  ==
>> >>>>>>> >>  > >>  > > 0)
>> >>>>>>> >>  > >>  > > > {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >          return null;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      pf_AddressTypeController controller
>> >>>>>>> >>  > >>  =
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > (pf_AddressTypeController)
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > > facesContext.getApplication().getELResolver().
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > getValue(facesContext.getELContext(),
>> >>>>>>> >>  > >>  > > > > > > > null,
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > "pf_addressTypeController");
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      return
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> > controller.ejbFacade.find(getKey(value));
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > java.lang.Integer getKey(String value) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      java.lang.Integer key;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      key = Integer.valueOf(value);
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      return key;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > String getStringKey(java.lang.Integer
>> >>>>>>> >>  > >>  > > value) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      StringBuffer sb = new
>> >>>>>>> >>  > >>  StringBuffer();
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      sb.append(value);
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      return sb.toString();
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > public String getAsString(FacesContext
>> >>>>>>> >>  > >>  > > > > > facesContext,
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> > UIComponent
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > component, Object object) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      if (object == null) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >          return null;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      if (object instanceof AddressType) {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >          AddressType o = (AddressType)
>> >>>>>>> >>  > >>  > > object;
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >          return
>> >>>>>>> >>  > >>  > > > > getStringKey(o.getAddressTypeId());
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      } else {
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >          throw new
>> >>>>>>> >>  > >>  > > > > IllegalArgumentException("object
>> >>>>>>> >>  > >>  > > > > > > " +
>> >>>>>>> >>  > >>  > > > > > > > > > >> object
>> >>>>>>> >>  > >>  > > > > > > > > > >> > +
>> >>>>>>> > "
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > is of
>> >>>>>>> >>  > > type " + object.getClass().getName() + ";
>> >>>>>>> >>  > >>  > > > expected
>> >>>>>>> >>  > >>  > > > > > > type:
>> >>>>>>> >>  > >>  > > > > > > > > " +
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > pf_AddressTypeController.class.getName());
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >      }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > > }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >     }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > }
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  >
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>
>> >>>>>>> >>  > >>  > > > > > > > > > >> >
>> >>>>>>> >>  > >>  > > > > > > > > > >>
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > > >
>> >>>>>>> >>  > >>  > > > > > > >
>> >>>>>>> >>  > >>  > > > > > >
>> >>>>>>> >>  > >>  > > > > >
>> >>>>>>> >>  > >>  > > > >
>> >>>>>>> >>  > >>  > > >
>> >>>>>>> >>  > >>  > >
>> >>>>>>> >>  > >>  >
>> >>>>>>> >>  > >>
>> >>>>>>> >>  > >
>> >>>>>>> >>  >
>> >>>>>>> >>
>> >>>>>>> >
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>
>> >>>>
>> >>>
>> >>
>> >
>>
>
>

Reply via email to