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. <[email protected]>

> 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 <
> [email protected]> 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. <[email protected]>
>>
>> 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 <
>>> [email protected]> 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 <[email protected]>
>>>>
>>>>> 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." <[email protected]>
>>>>> > To: MyFaces Discussion <[email protected]>; Rafael Pestano <
>>>>> [email protected]>
>>>>> > 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
>>>>> > <[email protected]>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." <[email protected]>
>>>>> >>  Para: Mark Struberg <[email protected]>; MyFaces Discussion <
>>>>> >>  [email protected]>
>>>>> >>  Cc: "[email protected]" <[email protected]>
>>>>> >>  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"
>>>>> > <[email protected]> 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."
>>>>> > <[email protected]>
>>>>> >>  > > To: [email protected]; MyFaces Discussion <
>>>>> >>  > [email protected]>
>>>>> >>  > > 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"
>>>>> >>  > > <[email protected]>
>>>>> >>  > > 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.
>>>>> > <[email protected]>
>>>>> >>  > >>
>>>>> >>  > >>  > 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"
>>>>> >>  > > <[email protected]>
>>>>> >>  > >>  > 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.
>>>>> > <[email protected]>
>>>>> >>  > >>  > >
>>>>> >>  > >>  > > > Faces context? Please explain.
>>>>> >>  > >>  > > >  On Nov 20, 2012 1:56 AM, "Romain
>>>>> > Manni-Bucau"
>>>>> >>  > > <
>>>>> >>  > >>  [email protected]>
>>>>> >>  > >>  > > > wrote:
>>>>> >>  > >>  > > >
>>>>> >>  > >>  > > > > You cant use faces context?
>>>>> >>  > >>  > > > > Le 20 nov. 2012 03:01, "Howard W.
>>>>> > Smith, Jr."
>>>>> >>  > > <
>>>>> >>  > >>  > [email protected]>
>>>>> >>  > >>  > > 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
>>>>> >>  > >>  > > > > > <[email protected]>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." <
>>>>> >>  > >>  > > > [email protected]>
>>>>> >>  > >>  > > > > 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
>>>>> >>  > >>  > > > > > > >
>>>>> > <[email protected]>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." <
>>>>> >>  > >>  > > > > > [email protected]>
>>>>> >>  > >>  > > > > > > 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. <
>>>>> >>  > >>  > > > > > > > > >
>>>>> > [email protected]>
>>>>> >>  > > 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 <
>>>>> >>  > >>  > > > > > > > > >
>>>>> > [email protected]
>>>>> >>  > >>  > > > > > > > > > > >
>>>>> > wrote:
>>>>> >>  > >>  > > > > > > > > > >
>>>>> >>  > >>  > > > > > > > > > >> Maybe
>>>>> > use
>>>>> >>  > > BeanProvider of deltaspike
>>>>> >>  > >>  > > > > > > > > > >> Le 19
>>>>> > nov. 2012
>>>>> >>  > > 20:50, "Howard W. Smith, Jr." <
>>>>> >>  > >>  > > > > > > > [email protected]
>>>>> >>  > >>  > > > > > > > > >
>>>>> >>  > >>  > > > > > > > > > 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
>>>>> >>  > >>  > > > > > > > > > >> >
>>>>> >>  > > <[email protected]>wrote:
>>>>> >>  > >>  > > > > > > > > > >> >
>>>>> >>  > >>  > > > > > > > > > >> >
>>>>> >>  Can you
>>>>> >>  > > reproduce it in a sample? What is on the
>>>>> >>  > >>  npe
>>>>> >>  > >>  > > > line?
>>>>> >>  > >>  > > > > > > > > > >> >
>>>>> >>  Le 19 nov.
>>>>> >>  > > 2012 20:25, "Howard W. Smith, Jr." <
>>>>> >>  > >>  > > > > > > > > >
>>>>> > [email protected]>
>>>>> >>  > >>  > > > > > > > > > >> 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