You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Xavier Dury <ka...@hotmail.com> on 2016/09/28 13:29:14 UTC

OpenEJB and EL

Hi,

I am using OpenEJB for my tests and need support for EL expressions in my own code.

By default, if I do something like this (pay attention to the expression):

ExpressionFactory factory = beanManager.wrapExpressionFactory(ExpressionFactory.newInstance());
StandardELContext elContext = new StandardELContext(factory);
elContext.addELResolver(beanManager.getELResolver());
ValueExpression expression = factory.createValueExpression(elContext, "#{javax.enterprise.context.conversation.transient}", Boolean.class);
expression.getValue(elContext);

and only add org.apache.tomee:openejb-core:7.0.1 to my project then I get javax.el.ELException: Unable to find ExpressionFactory of type: org.apache.el.ExpressionFactoryImpl

if I add org.glassfish:javax.el:3.0.0 then I get javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'javax'

if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.ExpressionFactory < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated but I can't use any new feature of 3.0 (like lambdas)

So, either my dependencies are wrong or I am not correctly initializing my factory.

Does anybody have an idea?

Thanks,

Xavier

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Well, in EL dots are actually explicitly forbidden. Or in other words: they are reserved to separate the 'layers'.


We discussed about escaping in the CDI and Servlet Expert Groups and you might google it if you are prepared for some serious headache ;)

LieGrue,
strub




> On Wednesday, 28 September 2016, 23:19, Xavier Dury <ka...@hotmail.com> wrote:
> > @Romain:
> 
> thanks for the  piece of code, this is indeed pure hackiness ;-)
> I can live with  '.isTransient()' instead of '.transient' so I 
> won't need to disable the identifier check I guess.
> I tried the @Produces @Named but it gave some conflict errors with the OWB 
> built-in conversation bean.
> 
> @Mark:
> 
> thanks, I will try the wrapper way.
> 
> I hope a future revision for EL will allow to escape names (spring-el does it 
> like #{@'bean.name'.property})
> 
> Xavier
> 
> 
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:10 PM
> To: users@tomee.apache.org; Mark Struberg
> Subject: Re: OpenEJB and EL
>    
> a producer allows to get a shorter/more elegant naming like #{conv.id} if
> you @Produces @Named("conv") ;)
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: 
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> 
> 
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, 
> Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github 
> <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 
> 2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> 
>>  Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>> 
>>  Problem is that the EE umbrella spec, the EL spec and the CDI spec
>>  contradict each other.
>> 
>>  The Weld guys solved this by introducing a Javax class. But that takes
>>  away the whole javax.* tree for the EL. That's just not good as it
>>  contradicts the EL spec.
>> 
>>  Could you please try the following
>> 
>>  @RequestScoped
>>  @Named("conversation")
>>  public class ConversationWrapper {
>>     private @Inject Conversation conv;
>> 
>>    public Conversation get() {
>>         return conv;
>>     }
>>  }
>> 
>>  And in the EL just use #{conversation.get.id}
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>> 
>> 
>>  > On Wednesday, 28 September 2016, 22:12, Xavier Dury 
> <ka...@hotmail.com>
>>  wrote:
>>  > > I really don't understand how something like <f:param
>>  > name="cid"
>>  > 
> value="#{javax.enterprise.context.conversation.id}"/> actually
>>  > works... something must be made to make the EL processor accept that
>>  invalid
>>  > bean name.
>>  >
>>  > Making a producer which @Produces @Named Conversation conflicts with 
> the
>>  > built-in bean from OWB (with WebBeanType.CONVERSATION)...
>>  >
>>  > ... so, I have done the following for my tests but I feel a bit 
> ashamed
>>  because
>>  > I can't imagine there is no better solution than this ;-)
>>  >
>>  > public class ConversationAliaser {
>>  >     public class Javax {
>>  >         public Enterprise getEnterprise() {return new 
> Enterprise();}
>>  >
>>  >     }
>>  >     public class Enterprise {
>>  >         public Context getContext() {return new Context();}
>>  >     }
>>  >     public class Context {
>>  >         public Conversation getConversation() {return 
> conversation;}
>>  >
>>  >     }
>>  >     @Inject
>>  >     private Conversation conversation;
>>  >     @Produces @ApplicationScoped @Named("javax")
>>  >     public Javax javax() {return new Javax();}
>>  > }
>>  >
>>  > But that works!
>>  >
>>  > Xavier
>>  >
>>  >
>>  >
>>  > From: Xavier Dury <ka...@hotmail.com>
>>  > Sent: Wednesday, September 28, 2016 8:42 PM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > Hmmm... I guess I'll have to @Produces @Named the conversation if 
> I want
>>  to
>>  > use it in ELs. I don't know if something like
>>  > 
> #{applicationScope['javax.enterprise.context.conversation'].transient}
>>  > would work?
>>  >
>>  > I remember back in my JSP days that, sometimes, I had to use something
>>  like
>>  > ${requestScope['javax.servlet.forward.request_uri']} 
> instead of
>>  > plain ${javax.servlet.forward.request_uri}.
>>  >
>>  > Xavier
>>  >
>>  >
>>  > From: Romain Manni-Bucau <rm...@gmail.com>
>>  > Sent: Wednesday, September 28, 2016 6:54 PM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > hmm, wonder if it is linked to the value you try to evaluate (which
>>  doesn't
>>  > respect EL spec even if in CDI spec - don't ask please ;)).. See
>>  > https://issues.jboss.org/browse/CDITCK-462 /
>>  > http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html
>>  >
>>  >
>>  >
>>  >
>>  > Romain Manni-Bucau
>>  > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>  >
>>  >
>>  >
>>  > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > twitter.com
>>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / 
> Java(EE)
>>  /
>>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > https://t.co/0VnvWwbedt . Blog ...
>>  > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>>  > <http://rmannibucau.wordpress.com> | Github
>>  > <https://github.com/rmannibucau> |
>>  > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>  > <http://www.tomitribe.com> | JavaEE Factory
>>  > <https://javaeefactory-rmannibucau.rhcloud.com>
>>  >
>>  > 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>>  >
>>  >>  Hi Romain,
>>  >>
>>  >>  I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does 
> not
>>  >>  parse my expression until I change ".transient" by
>>  > ".isTransient()" and
>>  >>  then it gives the same error: javax.el.PropertyNotFoundException:
>>  >>  ELResolver cannot handle a null base Object with identifier
>>  > 'javax'.
>>  >>
>>  >>  Does the EL context need something else than adding the
>>  >>  BeanManager.getELResolver()  to be able to resolve some implicit
>>  objects? I
>>  >>  don't understand why it works with ri-1.0.
>>  >>
>>  >>  Xavier
>>  >>
>>  >>
>>  >>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  >>  Sent: Wednesday, September 28, 2016 4:02 PM
>>  >>  To: users@tomee.apache.org
>>  >>  Subject: Re: OpenEJB and EL
>>  >>
>>  >>  Hi Xavier
>>  >>
>>  >>  On the phone so hard to give you a link bit try using tomcat el 
> impl of
>>  >>  tomcat 8.5
>>  >>
>>  >>  Le 28 sept. 2016 15:29, "Xavier Dury" 
> <ka...@hotmail.com>
>>  > a écrit :
>>  >>
>>  >>  > Hi,
>>  >>  >
>>  >>  > I am using OpenEJB for my tests and need support for EL 
> expressions
>>  in
>>  > my
>>  >>  > own code.
>>  >>  >
>>  >>  > By default, if I do something like this (pay attention to 
> the
>>  >>  expression):
>>  >>  >
>>  >>  > ExpressionFactory factory = 
> beanManager.wrapExpressionFactory(
>>  >>  > ExpressionFactory.newInstance());
>>  >>  > StandardELContext elContext = new 
> StandardELContext(factory);
>>  >>  > elContext.addELResolver(beanManager.getELResolver());
>>  >>  > ValueExpression expression = factory.createValueExpression(
>>  elContext,
>>  >>  > 
> "#{javax.enterprise.context.conversation.transient}",
>>  > Boolean.class);
>>  >>  > expression.getValue(elContext);
>>  >>  >
>>  >>  > and only add org.apache.tomee:openejb-core:7.0.1 to my 
> project then
>>  I
>>  >>  get
>>  >>  > javax.el.ELException: Unable to find ExpressionFactory of 
> type:
>>  >>  > org.apache.el.ExpressionFactoryImpl
>>  >>  >
>>  >>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
>>  >>  PropertyNotFoundException:
>>  >>  > ELResolver cannot handle a null base Object with identifier
>>  > 'javax'
>>  >>  >
>>  >>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
>>  > META-INF/javax.el.
>>  >>  ExpressionFactory
>>  >>  > < com.sun.el.ExpressionFactoryImpl) then my expression 
> can be
>>  > evaluated
>>  >>  > but I can't use any new feature of 3.0 (like lambdas)
>>  >>  >
>>  >>  > So, either my dependencies are wrong or I am not correctly
>>  > initializing
>>  >>  my
>>  >>  > factory.
>>  >>  >
>>  >>  > Does anybody have an idea?
>>  >>  >
>>  >>  > Thanks,
>>  >>  >
>>  >>  > Xavier
>>  >>
>>  >>
>>  >
>> 
> 

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
@Romain:

thanks for the  piece of code, this is indeed pure hackiness ;-)
I can live with  '.isTransient()' instead of '.transient' so I won't need to disable the identifier check I guess.
I tried the @Produces @Named but it gave some conflict errors with the OWB built-in conversation bean.

@Mark:

thanks, I will try the wrapper way.

I hope a future revision for EL will allow to escape names (spring-el does it like #{@'bean.name'.property})

Xavier


From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 11:10 PM
To: users@tomee.apache.org; Mark Struberg
Subject: Re: OpenEJB and EL
    
a producer allows to get a shorter/more elegant naming like #{conv.id} if
you @Produces @Named("conv") ;)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:

> Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>
> Problem is that the EE umbrella spec, the EL spec and the CDI spec
> contradict each other.
>
> The Weld guys solved this by introducing a Javax class. But that takes
> away the whole javax.* tree for the EL. That's just not good as it
> contradicts the EL spec.
>
> Could you please try the following
>
> @RequestScoped
> @Named("conversation")
> public class ConversationWrapper {
>    private @Inject Conversation conv;
>
>   public Conversation get() {
>        return conv;
>    }
> }
>
> And in the EL just use #{conversation.get.id}
>
> LieGrue,
> strub
>
>
>
>
> > On Wednesday, 28 September 2016, 22:12, Xavier Dury <ka...@hotmail.com>
> wrote:
> > > I really don't understand how something like <f:param
> > name="cid"
> > value="#{javax.enterprise.context.conversation.id}"/> actually
> > works... something must be made to make the EL processor accept that
> invalid
> > bean name.
> >
> > Making a producer which @Produces @Named Conversation conflicts with the
> > built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >
> > ... so, I have done the following for my tests but I feel a bit ashamed
> because
> > I can't imagine there is no better solution than this ;-)
> >
> > public class ConversationAliaser {
> >     public class Javax {
> >         public Enterprise getEnterprise() {return new Enterprise();}
> >
> >     }
> >     public class Enterprise {
> >         public Context getContext() {return new Context();}
> >     }
> >     public class Context {
> >         public Conversation getConversation() {return conversation;}
> >
> >     }
> >     @Inject
> >     private Conversation conversation;
> >     @Produces @ApplicationScoped @Named("javax")
> >     public Javax javax() {return new Javax();}
> > }
> >
> > But that works!
> >
> > Xavier
> >
> >
> >
> > From: Xavier Dury <ka...@hotmail.com>
> > Sent: Wednesday, September 28, 2016 8:42 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Hmmm... I guess I'll have to @Produces @Named the conversation if I want
> to
> > use it in ELs. I don't know if something like
> > #{applicationScope['javax.enterprise.context.conversation'].transient}
> > would work?
> >
> > I remember back in my JSP days that, sometimes, I had to use something
> like
> > ${requestScope['javax.servlet.forward.request_uri']} instead of
> > plain ${javax.servlet.forward.request_uri}.
> >
> > Xavier
> >
> >
> > From: Romain Manni-Bucau <rm...@gmail.com>
> > Sent: Wednesday, September 28, 2016 6:54 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > hmm, wonder if it is linked to the value you try to evaluate (which
> doesn't
> > respect EL spec even if in CDI spec - don't ask please ;)).. See
> > https://issues.jboss.org/browse/CDITCK-462 /
> > http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html
> >
> >
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  Hi Romain,
> >>
> >>  I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> >>  parse my expression until I change ".transient" by
> > ".isTransient()" and
> >>  then it gives the same error: javax.el.PropertyNotFoundException:
> >>  ELResolver cannot handle a null base Object with identifier
> > 'javax'.
> >>
> >>  Does the EL context need something else than adding the
> >>  BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> >>  don't understand why it works with ri-1.0.
> >>
> >>  Xavier
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  Hi Xavier
> >>
> >>  On the phone so hard to give you a link bit try using tomcat el impl of
> >>  tomcat 8.5
> >>
> >>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> > a écrit :
> >>
> >>  > Hi,
> >>  >
> >>  > I am using OpenEJB for my tests and need support for EL expressions
> in
> > my
> >>  > own code.
> >>  >
> >>  > By default, if I do something like this (pay attention to the
> >>  expression):
> >>  >
> >>  > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> >>  > ExpressionFactory.newInstance());
> >>  > StandardELContext elContext = new StandardELContext(factory);
> >>  > elContext.addELResolver(beanManager.getELResolver());
> >>  > ValueExpression expression = factory.createValueExpression(
> elContext,
> >>  > "#{javax.enterprise.context.conversation.transient}",
> > Boolean.class);
> >>  > expression.getValue(elContext);
> >>  >
> >>  > and only add org.apache.tomee:openejb-core:7.0.1 to my project then
> I
> >>  get
> >>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> >>  > org.apache.el.ExpressionFactoryImpl
> >>  >
> >>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> >>  PropertyNotFoundException:
> >>  > ELResolver cannot handle a null base Object with identifier
> > 'javax'
> >>  >
> >>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> > META-INF/javax.el.
> >>  ExpressionFactory
> >>  > < com.sun.el.ExpressionFactoryImpl) then my expression can be
> > evaluated
> >>  > but I can't use any new feature of 3.0 (like lambdas)
> >>  >
> >>  > So, either my dependencies are wrong or I am not correctly
> > initializing
> >>  my
> >>  > factory.
> >>  >
> >>  > Does anybody have an idea?
> >>  >
> >>  > Thanks,
> >>  >
> >>  > Xavier
> >>
> >>
> >
>
    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Yes a posibility to escape the dots in EL would be great. 
Too bad that EL doesn’t fully follow ECMAScript conventions but is only ’similar’ to it.

LieGrue,
strub

> Am 29.09.2016 um 20:33 schrieb Xavier Dury <ka...@hotmail.com>:
> 
> I concur: (a) would be best... maybe in EL 3.1 or 4.0? (I don't know if a revision of the EL spec is foreseen for Java EE 8 but I hope so).
> 

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
I concur: (a) would be best... maybe in EL 3.1 or 4.0? (I don't know if a revision of the EL spec is foreseen for Java EE 8 but I hope so).






From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Thursday, September 29, 2016 8:21 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
well best would probably be to:

a. allow to escape dots
b. allow to resolve by bucket (if javax doesnt exist try javax.enterprise
etc...)
c. give a beans handler in CDI


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-29 20:20 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Well, replace JspResolver by ServletResolver in my previous message...
>
>
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Thursday, September 29, 2016 8:18 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Indeed, el resolvers should then be splitted like this:
>
> - JspResolver
> - CdiResolver
> - JavaxResolver // must always come last, greedily constructs the chain of
> identifiers starting with 'javax'
>
> [JspResovler]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base instanceof ExpandingImplicitObject) {
>                 ExpandingImplicitObject implicit =
> (ExpandingImplicitObject) base;
>                 if ("javax.servlet.forward".equals(implicit.getName())) {
>                         if ("query_string".equals(property)) {
>                                 // return query string
>                         }
>                         if ("context_path".equals(property)) {
>                                 // return context path
>                         }
>                         ...
>                 }
>                 if ("javax.servlet.include".equals(implicit.getName())) {
>                         if ("query_string".equals(property)) {
>                                 // return query string
>                         }
>                         if ("context_path".equals(property)) {
>                                 // return context path
>                         }
>                         ...
>                 }
>         }
>         return null;
> }
>
> [CdiResolver]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base instanceof ExpandingImplicitObject) {
>                 ExpandingImplicitObject implicit =
> (ExpandingImplicitObject) base;
>                 if ("javax.enterprise.context".equals(implicit.getName())
> && "conversation".equals(property)) {
>                         // return conversation
>                 }
>         }
>         return null;
> }
>
> [JavaxResolver]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base == null && "javax".equals(property)) {
>                 context.setPropertyResolved(base, property);
>                 return new ExpandingImplicitObject("javax");
>         }
>         if (base instanceof ExpandingImplicitObject && property instanceof
> String) {
>                 context.setPropertyResolved(base, property);
>                 return ((ExpandingImplicitObject) base).expand((String)
> property);
>         }
>         return null;
> }
>
> This could be totally portable on one condition: that the identifier chain
> (or whatever you cant to call it, ExpandingImplicitObject in my example)
> class be shared in a common module between Jsp and Cdi (el-api?)
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 5:18 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> The problems are in the details.
>
> an EL #{javax.enterprise.context.conversation.id}
> will iterate over the EL loader chain a whooping 5 times!
>
> First it will resolve „javax“. Then on that object it will resolve
> „enterprise“, then …
> And on the last (id) you will finally hit the OWB WebBeansELResolver.
>
> The problem is that you have no way of knowing if after „java“ there will
> be a „servlet“ or an „enterprise“…
> So if you implement this for CDI, then there is no way any other spec can
> implement it.
>
> This would only be possible if there is a single instance for the whole EE
> container. Which is perfectly doable in TomEE - but not in OWB.
>
> LieGrue,
> strub
>
>
> > Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > yep, you can add a test on "enterprise" as well.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
>
>
>
> rmannibucau (Romain Manni-Bucau) · GitHub
> github.com
> rmannibucau has 99 repositories available. Follow their code on GitHub.
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>
>
>
> Romain Manni-Bucau | LinkedIn
> www.linkedin.com
> View Romain Manni-Bucau’s professional profile on LinkedIn. LinkedIn is
> the world's largest business network, helping professionals like Romain
> Manni-Bucau discover ...
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >> something like this? https://gist.github.com/kalgon/
> >> c1ccffff45540a629314f615b90f944f
> >>
> >>
> >>
>
>
>
    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Handling by buckets creates an effort of around O(n^2) :(

EL is already slow due to the tons of empty iterations. Any additonal work would hurt badly. 

LieGrue,
strub

> Am 29.09.2016 um 20:21 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> well best would probably be to:
> 
> a. allow to escape dots
> b. allow to resolve by bucket (if javax doesnt exist try javax.enterprise
> etc...)
> c. give a beans handler in CDI
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-29 20:20 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>> Well, replace JspResolver by ServletResolver in my previous message...
>> 
>> 
>> 
>> 
>> From: Xavier Dury <ka...@hotmail.com>
>> Sent: Thursday, September 29, 2016 8:18 PM
>> To: users@tomee.apache.org
>> Subject: Re: OpenEJB and EL
>> 
>> Indeed, el resolvers should then be splitted like this:
>> 
>> - JspResolver
>> - CdiResolver
>> - JavaxResolver // must always come last, greedily constructs the chain of
>> identifiers starting with 'javax'
>> 
>> [JspResovler]
>> public Object getValue(ELContext context, Object base, Object property) {
>>        if (base instanceof ExpandingImplicitObject) {
>>                ExpandingImplicitObject implicit =
>> (ExpandingImplicitObject) base;
>>                if ("javax.servlet.forward".equals(implicit.getName())) {
>>                        if ("query_string".equals(property)) {
>>                                // return query string
>>                        }
>>                        if ("context_path".equals(property)) {
>>                                // return context path
>>                        }
>>                        ...
>>                }
>>                if ("javax.servlet.include".equals(implicit.getName())) {
>>                        if ("query_string".equals(property)) {
>>                                // return query string
>>                        }
>>                        if ("context_path".equals(property)) {
>>                                // return context path
>>                        }
>>                        ...
>>                }
>>        }
>>        return null;
>> }
>> 
>> [CdiResolver]
>> public Object getValue(ELContext context, Object base, Object property) {
>>        if (base instanceof ExpandingImplicitObject) {
>>                ExpandingImplicitObject implicit =
>> (ExpandingImplicitObject) base;
>>                if ("javax.enterprise.context".equals(implicit.getName())
>> && "conversation".equals(property)) {
>>                        // return conversation
>>                }
>>        }
>>        return null;
>> }
>> 
>> [JavaxResolver]
>> public Object getValue(ELContext context, Object base, Object property) {
>>        if (base == null && "javax".equals(property)) {
>>                context.setPropertyResolved(base, property);
>>                return new ExpandingImplicitObject("javax");
>>        }
>>        if (base instanceof ExpandingImplicitObject && property instanceof
>> String) {
>>                context.setPropertyResolved(base, property);
>>                return ((ExpandingImplicitObject) base).expand((String)
>> property);
>>        }
>>        return null;
>> }
>> 
>> This could be totally portable on one condition: that the identifier chain
>> (or whatever you cant to call it, ExpandingImplicitObject in my example)
>> class be shared in a common module between Jsp and Cdi (el-api?)
>> 
>> 
>> 
>> 
>> 
>> 
>> From: Mark Struberg <st...@yahoo.de.INVALID>
>> Sent: Thursday, September 29, 2016 5:18 PM
>> To: users@tomee.apache.org
>> Subject: Re: OpenEJB and EL
>> 
>> The problems are in the details.
>> 
>> an EL #{javax.enterprise.context.conversation.id}
>> will iterate over the EL loader chain a whooping 5 times!
>> 
>> First it will resolve „javax“. Then on that object it will resolve
>> „enterprise“, then …
>> And on the last (id) you will finally hit the OWB WebBeansELResolver.
>> 
>> The problem is that you have no way of knowing if after „java“ there will
>> be a „servlet“ or an „enterprise“…
>> So if you implement this for CDI, then there is no way any other spec can
>> implement it.
>> 
>> This would only be possible if there is a single instance for the whole EE
>> container. Which is perfectly doable in TomEE - but not in OWB.
>> 
>> LieGrue,
>> strub
>> 
>> 
>>> Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
>>> :
>>> 
>>> yep, you can add a test on "enterprise" as well.
>>> 
>>> 
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> 
>> 
>> 
>> Romain Manni-Bucau (@rmannibucau) | Twitter
>> twitter.com
>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>> https://t.co/0VnvWwbedt . Blog ...
>> 
>> 
>> 
>> Romain Manni-Bucau (@rmannibucau) | Twitter
>> twitter.com
>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>> https://t.co/0VnvWwbedt . Blog ...
>>> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>> 
>> 
>> RBlog: the RManniBucau v2 Blog
>> blog-rmannibucau.rhcloud.com
>> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
>> Source, Code and geeky topics...
>>> <http://rmannibucau.wordpress.com> | Github <https://github.com/
>> rmannibucau> |
>> 
>> 
>> 
>> [old blog] new RManniBucau().blog()
>> rmannibucau.wordpress.com
>> New blog on: https://blog-rmannibucau.rhcloud.com/
>> 
>> 
>> 
>> rmannibucau (Romain Manni-Bucau) · GitHub
>> github.com
>> rmannibucau has 99 repositories available. Follow their code on GitHub.
>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>> 
>> 
>> 
>> Romain Manni-Bucau | LinkedIn
>> www.linkedin.com
>> View Romain Manni-Bucau’s professional profile on LinkedIn. LinkedIn is
>> the world's largest business network, helping professionals like Romain
>> Manni-Bucau discover ...
>>> <http://www.tomitribe.com> | JavaEE Factory
>>> <https://javaeefactory-rmannibucau.rhcloud.com>
>>> 
>>> 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>>> 
>>>> something like this? https://gist.github.com/kalgon/
>>>> c1ccffff45540a629314f615b90f944f
>>>> 
>>>> 
>>>> 
>> 
>> 
>> 


Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well best would probably be to:

a. allow to escape dots
b. allow to resolve by bucket (if javax doesnt exist try javax.enterprise
etc...)
c. give a beans handler in CDI


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-29 20:20 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Well, replace JspResolver by ServletResolver in my previous message...
>
>
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Thursday, September 29, 2016 8:18 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Indeed, el resolvers should then be splitted like this:
>
> - JspResolver
> - CdiResolver
> - JavaxResolver // must always come last, greedily constructs the chain of
> identifiers starting with 'javax'
>
> [JspResovler]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base instanceof ExpandingImplicitObject) {
>                 ExpandingImplicitObject implicit =
> (ExpandingImplicitObject) base;
>                 if ("javax.servlet.forward".equals(implicit.getName())) {
>                         if ("query_string".equals(property)) {
>                                 // return query string
>                         }
>                         if ("context_path".equals(property)) {
>                                 // return context path
>                         }
>                         ...
>                 }
>                 if ("javax.servlet.include".equals(implicit.getName())) {
>                         if ("query_string".equals(property)) {
>                                 // return query string
>                         }
>                         if ("context_path".equals(property)) {
>                                 // return context path
>                         }
>                         ...
>                 }
>         }
>         return null;
> }
>
> [CdiResolver]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base instanceof ExpandingImplicitObject) {
>                 ExpandingImplicitObject implicit =
> (ExpandingImplicitObject) base;
>                 if ("javax.enterprise.context".equals(implicit.getName())
> && "conversation".equals(property)) {
>                         // return conversation
>                 }
>         }
>         return null;
> }
>
> [JavaxResolver]
> public Object getValue(ELContext context, Object base, Object property) {
>         if (base == null && "javax".equals(property)) {
>                 context.setPropertyResolved(base, property);
>                 return new ExpandingImplicitObject("javax");
>         }
>         if (base instanceof ExpandingImplicitObject && property instanceof
> String) {
>                 context.setPropertyResolved(base, property);
>                 return ((ExpandingImplicitObject) base).expand((String)
> property);
>         }
>         return null;
> }
>
> This could be totally portable on one condition: that the identifier chain
> (or whatever you cant to call it, ExpandingImplicitObject in my example)
> class be shared in a common module between Jsp and Cdi (el-api?)
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 5:18 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> The problems are in the details.
>
> an EL #{javax.enterprise.context.conversation.id}
> will iterate over the EL loader chain a whooping 5 times!
>
> First it will resolve „javax“. Then on that object it will resolve
> „enterprise“, then …
> And on the last (id) you will finally hit the OWB WebBeansELResolver.
>
> The problem is that you have no way of knowing if after „java“ there will
> be a „servlet“ or an „enterprise“…
> So if you implement this for CDI, then there is no way any other spec can
> implement it.
>
> This would only be possible if there is a single instance for the whole EE
> container. Which is perfectly doable in TomEE - but not in OWB.
>
> LieGrue,
> strub
>
>
> > Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > yep, you can add a test on "enterprise" as well.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
>
>
>
> rmannibucau (Romain Manni-Bucau) · GitHub
> github.com
> rmannibucau has 99 repositories available. Follow their code on GitHub.
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>
>
>
> Romain Manni-Bucau | LinkedIn
> www.linkedin.com
> View Romain Manni-Bucau’s professional profile on LinkedIn. LinkedIn is
> the world's largest business network, helping professionals like Romain
> Manni-Bucau discover ...
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >> something like this? https://gist.github.com/kalgon/
> >> c1ccffff45540a629314f615b90f944f
> >>
> >>
> >>
>
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Well, replace JspResolver by ServletResolver in my previous message...




From: Xavier Dury <ka...@hotmail.com>
Sent: Thursday, September 29, 2016 8:18 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Indeed, el resolvers should then be splitted like this:

- JspResolver
- CdiResolver
- JavaxResolver // must always come last, greedily constructs the chain of identifiers starting with 'javax'

[JspResovler]
public Object getValue(ELContext context, Object base, Object property) {
        if (base instanceof ExpandingImplicitObject) {
                ExpandingImplicitObject implicit = (ExpandingImplicitObject) base;
                if ("javax.servlet.forward".equals(implicit.getName())) {
                        if ("query_string".equals(property)) {
                                // return query string
                        }
                        if ("context_path".equals(property)) {
                                // return context path
                        }
                        ...
                }
                if ("javax.servlet.include".equals(implicit.getName())) {
                        if ("query_string".equals(property)) {
                                // return query string
                        }
                        if ("context_path".equals(property)) {
                                // return context path
                        }
                        ...
                }
        }
        return null;
}       

[CdiResolver]
public Object getValue(ELContext context, Object base, Object property) {
        if (base instanceof ExpandingImplicitObject) {
                ExpandingImplicitObject implicit = (ExpandingImplicitObject) base;
                if ("javax.enterprise.context".equals(implicit.getName()) && "conversation".equals(property)) {
                        // return conversation
                }
        }
        return null;
}       
        
[JavaxResolver]
public Object getValue(ELContext context, Object base, Object property) {
        if (base == null && "javax".equals(property)) {
                context.setPropertyResolved(base, property);
                return new ExpandingImplicitObject("javax");
        }
        if (base instanceof ExpandingImplicitObject && property instanceof String) {
                context.setPropertyResolved(base, property);
                return ((ExpandingImplicitObject) base).expand((String) property);
        }
        return null;
}

This could be totally portable on one condition: that the identifier chain (or whatever you cant to call it, ExpandingImplicitObject in my example) class be shared in a common module between Jsp and Cdi (el-api?)






From: Mark Struberg <st...@yahoo.de.INVALID>
Sent: Thursday, September 29, 2016 5:18 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
The problems are in the details.

an EL #{javax.enterprise.context.conversation.id}
will iterate over the EL loader chain a whooping 5 times!

First it will resolve „javax“. Then on that object it will resolve „enterprise“, then …
And on the last (id) you will finally hit the OWB WebBeansELResolver.

The problem is that you have no way of knowing if after „java“ there will be a „servlet“ or an „enterprise“…
So if you implement this for CDI, then there is no way any other spec can implement it.

This would only be possible if there is a single instance for the whole EE container. Which is perfectly doable in TomEE - but not in OWB.

LieGrue,
strub


> Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> yep, you can add a test on "enterprise" as well.
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |



[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/



rmannibucau (Romain Manni-Bucau) · GitHub
github.com
rmannibucau has 99 repositories available. Follow their code on GitHub.
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber



Romain Manni-Bucau | LinkedIn
www.linkedin.com
View Romain Manni-Bucau’s professional profile on LinkedIn. LinkedIn is the world's largest business network, helping professionals like Romain Manni-Bucau discover ...
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>> something like this? https://gist.github.com/kalgon/
>> c1ccffff45540a629314f615b90f944f
>> 
>> 
>> 

        

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Indeed, el resolvers should then be splitted like this:

- JspResolver
- CdiResolver
- JavaxResolver // must always come last, greedily constructs the chain of identifiers starting with 'javax'

[JspResovler]
public Object getValue(ELContext context, Object base, Object property) {
	if (base instanceof ExpandingImplicitObject) {
		ExpandingImplicitObject implicit = (ExpandingImplicitObject) base;
		if ("javax.servlet.forward".equals(implicit.getName())) {
			if ("query_string".equals(property)) {
				// return query string
			}
			if ("context_path".equals(property)) {
				// return context path
			}
			...
		}
		if ("javax.servlet.include".equals(implicit.getName())) {
			if ("query_string".equals(property)) {
				// return query string
			}
			if ("context_path".equals(property)) {
				// return context path
			}
			...
		}
	}
	return null;
}	

[CdiResolver]
public Object getValue(ELContext context, Object base, Object property) {
	if (base instanceof ExpandingImplicitObject) {
		ExpandingImplicitObject implicit = (ExpandingImplicitObject) base;
		if ("javax.enterprise.context".equals(implicit.getName()) && "conversation".equals(property)) {
			// return conversation
		}
	}
	return null;
}	
	
[JavaxResolver]
public Object getValue(ELContext context, Object base, Object property) {
	if (base == null && "javax".equals(property)) {
		context.setPropertyResolved(base, property);
		return new ExpandingImplicitObject("javax");
	}
	if (base instanceof ExpandingImplicitObject && property instanceof String) {
		context.setPropertyResolved(base, property);
		return ((ExpandingImplicitObject) base).expand((String) property);
	}
	return null;
}

This could be totally portable on one condition: that the identifier chain (or whatever you cant to call it, ExpandingImplicitObject in my example) class be shared in a common module between Jsp and Cdi (el-api?)






From: Mark Struberg <st...@yahoo.de.INVALID>
Sent: Thursday, September 29, 2016 5:18 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
The problems are in the details.

an EL #{javax.enterprise.context.conversation.id}
will iterate over the EL loader chain a whooping 5 times!

First it will resolve „javax“. Then on that object it will resolve „enterprise“, then …
And on the last (id) you will finally hit the OWB WebBeansELResolver.

The problem is that you have no way of knowing if after „java“ there will be a „servlet“ or an „enterprise“…
So if you implement this for CDI, then there is no way any other spec can implement it.

This would only be possible if there is a single instance for the whole EE container. Which is perfectly doable in TomEE - but not in OWB.

LieGrue,
strub


> Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> yep, you can add a test on "enterprise" as well.
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |



[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/



rmannibucau (Romain Manni-Bucau) · GitHub
github.com
rmannibucau has 99 repositories available. Follow their code on GitHub.
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber



Romain Manni-Bucau | LinkedIn
www.linkedin.com
View Romain Manni-Bucau’s professional profile on LinkedIn. LinkedIn is the world's largest business network, helping professionals like Romain Manni-Bucau discover ...
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>> something like this? https://gist.github.com/kalgon/
>> c1ccffff45540a629314f615b90f944f
>> 
>> 
>> 

    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
The problems are in the details.

an EL #{javax.enterprise.context.conversation.id}
will iterate over the EL loader chain a whooping 5 times!

First it will resolve „javax“. Then on that object it will resolve „enterprise“, then … 
And on the last (id) you will finally hit the OWB WebBeansELResolver.

The problem is that you have no way of knowing if after „java“ there will be a „servlet“ or an „enterprise“…
So if you implement this for CDI, then there is no way any other spec can implement it.

This would only be possible if there is a single instance for the whole EE container. Which is perfectly doable in TomEE - but not in OWB.

LieGrue,
strub


> Am 29.09.2016 um 14:41 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> yep, you can add a test on "enterprise" as well.
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>> something like this? https://gist.github.com/kalgon/
>> c1ccffff45540a629314f615b90f944f
>> 
>> 
>> 


Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
yep, you can add a test on "enterprise" as well.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-29 14:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> something like this? https://gist.github.com/kalgon/
> c1ccffff45540a629314f615b90f944f
>
>
>
>
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Thursday, September 29, 2016 11:43 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> think it is doable with a custom ELResolver without having to hold this map
> which can be wrong for pseudo scoped beans.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-09-29 11:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> > Thanks, now I understand better why it is not implemented in OWB.
> >
> > Funny, I came to the same conclusion and was busy implementing an
> > @ApplicationScoped @Named Beans (which implements Map<String, Object> so
> I
> > can do #{beans['javax.enteprise.context.conversation']}.
> >
> > Xavier
> >
> >
> >
> >
> >
> >
> > From: Mark Struberg <st...@yahoo.de.INVALID>
> > Sent: Thursday, September 29, 2016 10:32 AM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Yea, now you probably understand my 'oh boy' reaction ;)
> >
> >
> > My initial reaction when discovering this problem back then (a few years
> > ago) was to simply replace the dots with underlines ->
> > javax_enterprise_context_conversation
> >
> > But this solution wasn't choosen.
> >
> >
> > The reason why I don't like to implement it in OWB is that CDI is sadly
> > _not_ the only spec which defined such. E.g. the Servlet specifies that
> > there is a request parameter 'javax.servlet.request.key_size' or
> > 'javax.servlet.error.message' and others.
> >
> > But despite all servlet request parameters are available via an
> ELResolver
> > it is also _not_ possible to simply write "#{javax.servlet.request.key_
> > size}".
> >
> > While in the servlet spec this was primarily targetted to be
> > programmatically available from the request attriubute (and EL is only an
> > implicit way), it is a 'first class citizen' in CDI. But still doesn't
> work.
> >
> > You could provide the following which is probably even more straight
> > forward than the producer:
> >
> >
> > @ApplicationScoped
> > @Named
> > public class NameResolver {
> >
> >   private @Inject BeanManager bm;
> >
> >
> >   public Object get(String beanName) {
> >     Set<Bean> beans = bm.getBeans(beanName);
> >     Bean bean = bm.resolve(beans);
> >     return bm.getReference(bean, bean.getType() or so,
> > bm.createCreationalContext());
> >
> >   }
> > }
> >
> >
> > (of course with null checks etc, just sketched that wo trying).
> > That should be available as #{nameResolver.get("javax.
> enterprise.context.
> > conversation")}
> >
> >
> > LieGrue,
> > strub
> >
> > > On Thursday, 29 September 2016, 9:21, Romain Manni-Bucau <
> > rmannibucau@gmail.com> wrote:
> > > > 2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >
> > >>  Indeed, @Named != named... got it! :-)
> > >>
> > >>  But I still fail to understand _where_ the workaround for
> > > 'javax...' is
> > >>  actually implemented:
> > >>
> > >>
> > > nowhere cause it introduces other issues in EL so the workaround is
> only
> > a
> > > workaround not a nasty way to get a feature.
> > >
> > >
> > >>  1) if it is implemented in OWB then why is
> > > 'elContext.addELResolver(beanManager.getELResolver());'
> > >>  not working? I would expect the returned el resolver to contain the
> > >>  workaround.
> > >>  2) if it is implemented elsewhere (TomEE for example), I don't
> > > understand
> > >>  why as this requirement comes from the CDI spec and should be
> > implemented
> > >>  in OWB... so back to (1)
> > >>
> > >>  I am stuck in an infinite loop ;-)
> > >>
> > >>
> > >>
> > >>
> > >>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>  Sent: Thursday, September 29, 2016 8:54 AM
> > >>  To: users@tomee.apache.org
> > >>  Subject: Re: OpenEJB and EL
> > >>
> > >>  2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >>
> > >>  > @Mark
> > >>  >
> > >>  > thanks, it works when adding any other qualifier!
> > >>  >
> > >>  > btw, do you think it would hurt to qualify the built-in
> conversation
> > > bean
> > >>  > with @Named("javax.enterprise.context.conversation") in OWB?
> > > That way I
> > >>  > could inject the built-in with @Inject @Named("javax.enteprise.
> > >>  context.conversation")
> > >>  > and expose it via @Produces @Named("conversation") without
> > > resorting to
> > >>  > some extra qualifier.
> > >>  >
> > >>  > @Romain
> > >>  >
> > >>  > I was wondering where exactly is your hacky el resolver
> implemented?
> > > If
> > >>  > the "javax.enterprise.context.conversation" name is a
> > > requirement coming
> > >>  > from the CDI spec, then I would suppose it is implemented in OWB
> (in
> > > the
> > >>  > resolver you get from the BeanManager) but as my tests with
> OEJB+OWB
> > >>  fail,
> > >>  > I suppose it is not there (or not enabled in some way). On the
> > > contrary,
> > >>  if
> > >>  > the requirement comes from the java EE spec, then I suppose it is
> > >>  > implemented in TomEE and that would explain why my tests fail.
> > >>  >
> > >>  >
> > >>  The name is built it in openwebbeans:
> > >>  https://github.com/apache/openwebbeans/blob/trunk/
> > >>  webbeans-impl/src/main/java/org/apache/webbeans/component/
> > >>  ConversationBean.java#L54
> > >>
> > >>  The spec states:
> > >>
> > >>  "The container provides a built-in bean with bean type Conversation,
> > > scope
> > >>  @RequestScoped, and qualifier@Default, named
> > >>  javax.enterprise.context.conversation."
> > >>
> > >>  So no qualifier @Named but a Bean<?> name (no comment ;))
> > >>
> > >>
> > >>  > Xavier
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> > >>  > Sent: Thursday, September 29, 2016 12:12 AM
> > >>  > To: users@tomee.apache.org
> > >>  > Subject: Re: OpenEJB and EL
> > >>  >
> > >>  > @Default is always assumed when you don't add a specific Qualifier
> > > other
> > >>  > than @Named and @Any.
> > >>  >
> > >>  > Xavier, can you please add any random qualifier? E.g. @Destroyed.
> > >>  >
> > >>  > This will stop CDI from complaining but EL should work.
> > >>  >
> > >>  > LieGrue,
> > >>  > strub
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  > > On Thursday, 29 September 2016, 0:04, Xavier Dury
> > > <ka...@hotmail.com>
> > >>  > wrote:
> > >>  > > >
> > > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
> >
> >
> >
> > OpenEjbElTest.java
> > gist.github.com
> > property=
> > >>
> > >>
> > >>
> > >>  OpenEjbElTest.java
> > >>  gist.github.com
> > >>  property=
> > >>  >
> > >>  >
> > >>  >
> > >>  > OpenEjbElTest.java
> > >>  > gist.github.com
> > >>  > property=
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > From: Xavier Dury <ka...@hotmail.com>
> > >>  > > Sent: Wednesday, September 28, 2016 11:54 PM
> > >>  > > To: users@tomee.apache.org
> > >>  > > Subject: Re: OpenEJB and EL
> > >>  > >
> > >>  > > No, I didn't add the @Default to the @Produces method.
> > >>  > >
> > >>  > > I verified:
> > >>  > >
> > >>  > > @RequestScoped
> > >>  > > public class ConversationWrapper {
> > >>  > >
> > >>  > >         private @Inject Conversation conv;
> > >>  > >
> > >>  > >         @Produces
> > >>  > >         @Dependent
> > >>  > >         @Named("conv")
> > >>  > >         public Conversation getConv() {
> > >>  > >                 return conv;
> > >>  > >         }
> > >>  > > }
> > >>  > >
> > >>  > > result:
> > >>  > >
> > >>  > > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> > > There
> > >>  > is more
> > >>  > > than one Bean with type javax.enterprise.context.
> > >>  ConversationQualifiers:
> > >>  > > [@javax.enterprise.inject.Default()]
> > >>  > > for injection into Field Injection Point, field name :  conv,
> > > Bean
> > >>  Owner
> > >>  > :
> > >>  > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > >>  > > Types:[java.lang.Object,eg.ConversationWrapper],
> > >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any]]
> > >>  > > found beans:
> > >>  > > ConversationImpl, WebBeansType:CONVERSATION,
> > >>  > > Name:javax.enterprise.context.conversation, API
> > >>  > > Types:[java.lang.Object,org.apache.webbeans.conversation.
> > >>  > ConversationImpl,javax.enterprise.context.Conversation],
> > >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  enterprise.inject.Any]
> > >>  > from
> > >>  > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any,javax.inject.Named]
> > >>  > > from
> > >>  > >
> > > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> > >>  > ConversationWrapper.class
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > From: Romain Manni-Bucau <rm...@gmail.com>
> > >>  > > Sent: Wednesday, September 28, 2016 11:47 PM
> > >>  > > To: users@tomee.apache.org
> > >>  > > Subject: Re: OpenEJB and EL
> > >>  > >
> > >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > > enterprise.inject.Any,javax.inject.Named] from
> > > file:/D:/development/
> > >>  > >
> > > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> > >>  > >
> > >>  > > Why is there @Default there? producer should only have the @Named
> > > you
> > >>  set
> > >>  > >
> > >>  > >
> > >>  > > Romain Manni-Bucau
> > >>  > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > >>
> > >>
> > >>
> > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  twitter.com
> > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  https://t.co/0VnvWwbedt . Blog ...
> > >>  >
> > >>  >
> > >>  >
> > >>  > Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > twitter.com
> > >>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > > Java(EE)
> > >>  /
> > >>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  > https://t.co/0VnvWwbedt . Blog ...
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > > twitter.com
> > >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > >>  Java(EE)
> > >>  > /
> > >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  > > https://t.co/0VnvWwbedt . Blog ...
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > > twitter.com
> > >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > >>  Java(EE)
> > >>  > /
> > >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  > > https://t.co/0VnvWwbedt . Blog ...
> > >>  > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > >>  > >
> > >>  > >
> > >>  > > RBlog: the RManniBucau v2 Blog
> > >>  > > blog-rmannibucau.rhcloud.com
> > >>  > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > > Angular, Open
> > >>  > Source,
> > >>  > > Code and geeky topics...
> > >>  > > <http://rmannibucau.wordpress.com> | Github
> > >>  > > <https://github.com/rmannibucau> |
> > >>  > >
> > >>  > >
> > >>  > > [old blog] new RManniBucau().blog()
> > >>  > > rmannibucau.wordpress.com
> > >>  > > New blog on: https://blog-rmannibucau.rhcloud.com/
> > >>  > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > > Tomitriber
> > >>  > > <http://www.tomitribe.com> | JavaEE Factory
> > >>  > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > >>  > >
> > >>  > > 2016-09-28 23:45 GMT+02:00 Xavier Dury
> > > <ka...@hotmail.com>:
> > >>  > >
> > >>  > >>  It seems that to inject the conversation in
> > >>  > > ConversationWrapper.conversation,
> > >>  > >>  OWB does consider both the build-in conversation bean and
> > > the
> > >>  produced
> > >>  > one
> > >>  > >>  from... ConversationWrapper.getConv().
> > >>  > >>
> > >>  > >>  I tried something like that:
> > >>  > >>
> > >>  > >>  @RequestScoped
> > >>  > >>  public class ConversationWrapper {
> > >>  > >>
> > >>  > >>          private @Inject
> > >>  > > @Named("javax.enterprise.context.conversation")
> > >>  > >>  Conversation conv;
> > >>  > >>
> > >>  > >>          @Produces
> > >>  > >>          @Dependent
> > >>  > >>          @Named("conv")
> > >>  > >>          public Conversation getConv() {
> > >>  > >>                  return conv;
> > >>  > >>          }
> > >>  > >>  }
> > >>  > >>
> > >>  > >>  But it gives the following error:
> > >>  > >>
> > >>  > >>  Caused by:
> > > javax.enterprise.inject.UnsatisfiedResolutionException:
> > >>  Api
> > >>  > >>  type [javax.enterprise.context.Conversation] is not found
> > > with the
> > >>  > >>  qualifiers
> > >>  > >>  Qualifiers:
> > > [@javax.inject.Named(value=javax.enterprise.context.
> > >>  > >>  conversation)]
> > >>  > >>  for injection into Field Injection Point, field name :
> > > conv, Bean
> > >>  > Owner :
> > >>  > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > >>  > >>  Types:[eg.ConversationWrapper,java.lang.Object],
> > >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any]]
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>  From: Xavier Dury <ka...@hotmail.com>
> > >>  > >>  Sent: Wednesday, September 28, 2016 11:34 PM
> > >>  > >>  To: users@tomee.apache.org
> > >>  > >>  Subject: Re: OpenEJB and EL
> > >>  > >>
> > >>  > >>  Got the same result with 'conv':
> > >>  > >>
> > >>  > >>  Caused by:
> > > javax.enterprise.inject.AmbiguousResolutionException:
> > >>  > There is
> > >>  > >>  more than one Bean with type
> > >>  > > javax.enterprise.context.ConversationQualifiers:
> > >>  > >>  [@javax.enterprise.inject.Default()]
> > >>  > >>  for injection into Field Injection Point, field name :
> > > conversation,
> > >>  > Bean
> > >>  > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > > Name:null, API
> > >>  > >>  Types:[java.lang.Object,eg.ConversationAliaser],
> > >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any]]
> > >>  > >>  found beans:
> > >>  > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > >>  > >>
> > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > >>  enterprise.inject.Any,javax.inject.Named] from
> > > file:/D:/development/
> > >>  > >>  workspaces/openejb-el/target/test-classes/eg/
> > >>  ConversationWrapper.class
> > >>  > >>  ConversationImpl, WebBeansType:CONVERSATION,
> > >>  > > Name:javax.enterprise.context.conversation,
> > >>  > >>  API
> > > Types:[org.apache.webbeans.conversation.ConversationImpl,
> > >>  > >>  javax.enterprise.context.Conversation,java.lang.Object],
> > >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any]
> > >>  > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > >>  > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > >>  > >>
> > > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>  > >>  Sent: Wednesday, September 28, 2016 11:29 PM
> > >>  > >>  To: users@tomee.apache.org
> > >>  > >>  Cc: Mark Struberg
> > >>  > >>  Subject: Re: OpenEJB and EL
> > >>  > >>
> > >>  > >>  missing @Named("conv")?
> > >>  > >>
> > >>  > >>
> > >>  > >>  Romain Manni-Bucau
> > >>  > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > >>  twitter.com
> > >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > > ASF /
> > >>  > Java(EE) /
> > >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > >>  twitter.com
> > >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > > ASF /
> > >>  > Java(EE) /
> > >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> > >>  > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress
> > > Blog
> > >>  > >>
> > >>  > >>
> > >>  > >>  RBlog: the RManniBucau v2 Blog
> > >>  > >>  blog-rmannibucau.rhcloud.com
> > >>  > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > > Angular,
> > >>  Open
> > >>  > >>  Source, Code and geeky topics...
> > >>  > >>  <http://rmannibucau.wordpress.com> | Github
> > > <https://github.com/
> > >>  > >>  rmannibucau> |
> > >>  > >>
> > >>  > >>
> > >>  > >>  [old blog] new RManniBucau().blog()
> > >>  > >>  rmannibucau.wordpress.com
> > >>  > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> > >>  > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > > Tomitriber
> > >>  > >>  <http://www.tomitribe.com> | JavaEE Factory
> > >>  > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> > >>  > >>
> > >>  > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury
> > > <ka...@hotmail.com>:
> > >>  > >>
> > >>  > >>  >
> > >>  > >>  > Caused by:
> > > javax.enterprise.inject.AmbiguousResolutionException:
> > >>  > There
> > >>  > >>  is
> > >>  > >>  > more than one Bean with type javax.enterprise.context.
> > >>  > >>  ConversationQualifiers:
> > >>  > >>  > [@javax.enterprise.inject.Default()]
> > >>  > >>  > for injection into Field Injection Point, field name :
> > >>  conversation,
> > >>  > >>  Bean
> > >>  > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > > Name:null, API
> > >>  > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> > >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > >>  enterprise.inject.Any]]
> > >>  > >>  > found beans:
> > >>  > >>  > Conversation, WebBeansType:PRODUCERMETHOD,
> > > Name:conversation, API
> > >>  > >>  >
> > > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> > >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > >>  > enterprise.inject.Any,javax.inject.Named] from
> > >>  file:/D:/development/
> > >>  > >>  > workspaces/openejb-el/target/test-classes/eg/
> > >>  > ConversationWrapper.class
> > >>  > >>  > ConversationImpl, WebBeansType:CONVERSATION,
> > >>  > >>  Name:javax.enterprise.context.conversation,
> > >>  > >>  > API
> > > Types:[org.apache.webbeans.conversation.ConversationImpl,
> > >>  > >>  >
> > > javax.enterprise.context.Conversation,java.lang.Object],
> > >>  > >>  >
> > >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  enterprise.inject.Any]
> > >>  > >>  > from
> > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > >>  > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > >>  > >>  >
> > > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> > >>  > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> > >>  > >>  > To: users@tomee.apache.org
> > >>  > >>  > Subject: Re: OpenEJB and EL
> > >>  > >>  >
> > >>  > >>  > +1
> > >>  > >>  >
> > >>  > >>  > means
> > >>  > >>  >
> > >>  > >>  > @RequestScoped
> > >>  > >>  >
> > >>  > >>  > public class ConversationWrapper {
> > >>  > >>  >   private @Inject Conversation conv;
> > >>  > >>  >
> > >>  > >>  >   @Produces
> > >>  > >>  >   @Dependent
> > >>  > >>  >   @Named("conv")
> > >>  > >>  >
> > >>  > >>  >   public Conversation getConv() {
> > >>  > >>  >     return conv;
> > >>  > >>  >   }
> > >>  > >>  > }
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  > On Wednesday, 28 September 2016, 23:10, Romain
> > > Manni-Bucau <
> > >>  > >>  > rmannibucau@gmail.com> wrote:
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  > >
> > >>  > >>  > >
> > >>  > >>  > >a producer allows to get a shorter/more elegant
> > > naming like
> > >>  > > #{conv.id}
> > >>  > >>  > if you @Produces @Named("conv") ;)
> > >>  > >>  > >
> > >>  > >>  > >
> > >>  > >>  > >
> > >>  > >>  > >Romain Manni-Bucau
> > >>  > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github
> > > | LinkedIn |
> > >>  > >>  > Tomitriber | JavaEE Factory
> > >>  > >>  > >
> > >>  > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> > >>  > > <st...@yahoo.de.invalid>:
> > >>  > >>  > >
> > >>  > >>  > >Oh boy, sorry for you. You did hit a blank spot in
> > > the CDI spec.
> > >>  > >>  > >>
> > >>  > >>  > >>Problem is that the EE umbrella spec, the EL
> > > spec and the CDI
> > >>  > > spec
> > >>  > >>  > contradict each other.
> > >>  > >>  > >>
> > >>  > >>  > >>The Weld guys solved this by introducing a
> > > Javax class. But
> > >>  > > that takes
> > >>  > >>  > away the whole javax.* tree for the EL. That's just
> > > not good as it
> > >>  > >>  > contradicts the EL spec.
> > >>  > >>  > >>
> > >>  > >>  > >>Could you please try the following
> > >>  > >>  > >>
> > >>  > >>  > >>@RequestScoped
> > >>  > >>  > >>@Named("conversation")
> > >>  > >>  > >>public class ConversationWrapper {
> > >>  > >>  > >>   private @Inject Conversation conv;
> > >>  > >>  > >>
> > >>  > >>  > >>  public Conversation get() {
> > >>  > >>  > >>       return conv;
> > >>  > >>  > >>   }
> > >>  > >>  > >>}
> > >>  > >>  > >>
> > >>  > >>  > >>And in the EL just use
> > > #{conversation.get.id}
> > >>  > >>  > >>
> > >>  > >>  > >>LieGrue,
> > >>  > >>  > >>strub
> > >>  > >>  > >>
> > >>  > >>  > >>
> > >>  > >>  > >>
> > >>  > >>  > >>
> > >>  > >>  > >>
> > >>  > >>  > >>> On Wednesday, 28 September 2016, 22:12,
> > > Xavier Dury <
> > >>  > >>  > kalgon@hotmail.com> wrote:
> > >>  > >>  > >>> > I really don't understand how
> > > something like
> > >>  > > <f:param
> > >>  > >>  > >>> name="cid"
> > >>  > >>  > >>> value="#{javax.enterprise.
> > >>  > > context.conversation.id}"/> actually
> > >>  > >>  > >>> works... something must be made to make
> > > the EL processor
> > >>  > > accept that
> > >>  > >>  > invalid
> > >>  > >>  > >>> bean name.
> > >>  > >>  > >>>
> > >>  > >>  > >>> Making a producer which @Produces @Named
> > > Conversation
> > >>  > > conflicts with
> > >>  > >>  > the
> > >>  > >>  > >>> built-in bean from OWB (with
> > > WebBeanType.CONVERSATION)...
> > >>  > >>  > >>>
> > >>  > >>  > >>> ... so, I have done the following for my
> > > tests but I feel
> > >>  > > a bit
> > >>  > >>  > ashamed because
> > >>  > >>  > >>> I can't imagine there is no better
> > > solution than this
> > >>  > > ;-)
> > >>  > >>  > >>>
> > >>  > >>  > >>> public class ConversationAliaser {
> > >>  > >>  > >>>     public class Javax {
> > >>  > >>  > >>>         public Enterprise getEnterprise()
> > > {return
> > >>  > > new Enterprise();}
> > >>  > >>  > >>>
> > >>  > >>  > >>>     }
> > >>  > >>  > >>>     public class Enterprise {
> > >>  > >>  > >>>         public Context getContext()
> > > {return new
> > >>  > > Context();}
> > >>  > >>  > >>>     }
> > >>  > >>  > >>>     public class Context {
> > >>  > >>  > >>>         public Conversation
> > > getConversation()
> > >>  > > {return conversation;}
> > >>  > >>  > >>>
> > >>  > >>  > >>>     }
> > >>  > >>  > >>>     @Inject
> > >>  > >>  > >>>     private Conversation conversation;
> > >>  > >>  > >>>     @Produces @ApplicationScoped
> > >>  > > @Named("javax")
> > >>  > >>  > >>>     public Javax javax() {return new
> > > Javax();}
> > >>  > >>  > >>> }
> > >>  > >>  > >>>
> > >>  > >>  > >>> But that works!
> > >>  > >>  > >>>
> > >>  > >>  > >>> Xavier
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>> From: Xavier Dury
> > > <ka...@hotmail.com>
> > >>  > >>  > >>> Sent: Wednesday, September 28, 2016 8:42
> > > PM
> > >>  > >>  > >>> To: users@tomee.apache.org
> > >>  > >>  > >>> Subject: Re: OpenEJB and EL
> > >>  > >>  > >>>
> > >>  > >>  > >>> Hmmm... I guess I'll have to @Produces
> > > @Named the
> > >>  > > conversation if I
> > >>  > >>  > want to
> > >>  > >>  > >>> use it in ELs. I don't know if
> > > something like
> > >>  > >>  > >>> #{applicationScope['javax.
> > > enterprise.context.
> > >>  > >>  > conversation'].transient}
> > >>  > >>  > >>> would work?
> > >>  > >>  > >>>
> > >>  > >>  > >>> I remember back in my JSP days that,
> > > sometimes, I had to
> > >>  > > use
> > >>  > >>  something
> > >>  > >>  > like
> > >>  > >>  > >>> ${requestScope['javax.servlet.
> > >>  > > forward.request_uri']} instead of
> > >>  > >>  > >>> plain ${javax.servlet.forward.
> > > request_uri}.
> > >>  > >>  > >>>
> > >>  > >>  > >>> Xavier
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>> From: Romain Manni-Bucau
> > > <rm...@gmail.com>
> > >>  > >>  > >>> Sent: Wednesday, September 28, 2016 6:54
> > > PM
> > >>  > >>  > >>> To: users@tomee.apache.org
> > >>  > >>  > >>> Subject: Re: OpenEJB and EL
> > >>  > >>  > >>>
> > >>  > >>  > >>> hmm, wonder if it is linked to the value
> > > you try to
> > >>  > > evaluate (which
> > >>  > >>  > doesn't
> > >>  > >>  > >>> respect EL spec even if in CDI spec -
> > > don't ask
> > >>  > > please ;)).. See
> > >>  > >>  > >>> https://issues.jboss.org/
> > > browse/CDITCK-462 /
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  > System Dashboard - JBoss Issue Tracker
> > >>  > >>  > issues.jboss.org
> > >>  > >>  > Atlassian JIRA Project Management Software
> > >>  > > (v6.4.11#64026-sha1:78f6ec4)
> > >>  > >>  > About JIRA; Report a problem; Powered by a free
> > > Atlassian JIRA open
> > >>  > >>  source
> > >>  > >>  > license for Red Hat ...
> > >>  > >>  > >>> http://lists.jboss.org/
> > > pipermail/cdi-dev/2015-
> > >>  > > January/006009.html
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>  > lists.jboss.org Mailing Lists
> > >>  > >>  > lists.jboss.org
> > >>  > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a
> > > listing of all
> > >>  > the
> > >>  > >>  > public mailing lists on lists.jboss.org. Click on a
> > > list name to
> > >>  get
> > >>  > >>  more
> > >>  > >>  > information ...
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>> Romain Manni-Bucau
> > >>  > >>  > >>> @rmannibucau <https://twitter.com/
> > > rmannibucau> |
> > >>  > > Blog
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>>
> > >>  > >>  > >>> Romain Manni-Bucau (@rmannibucau) |
> > > Twitter
> > >>  > >>  > >>> twitter.com
> > >>  > >>  > >>> The latest Tweets from Romain Manni-Bucau
> > > (@rmannibucau).
> > >>  > > ASF /
> > >>  > >>  > Java(EE) /
> > >>  > >>  > >>> Angular. LinkedIn:
> > > https://t.co/dX7XMGjbBi. JavaEE
> > >>  > > Factory:
> > >>  > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> > >>  > >>  > >>> <https://blog-rmannibucau.
> > > rhcloud.com> | Old
> > >>  > > Wordpress Blog
> > >>  > >>  > >>> <http://rmannibucau.wordpress. com>
> > > | Github
> > >>  > >>  > >>> <https://github.com/ rmannibucau> |
> > >>  > >>  > >>> LinkedIn <https://www.linkedin.com/in/
> > > rmannibucau>
> > >>  > > | Tomitriber
> > >>  > >>  > >>> <http://www.tomitribe.com> | JavaEE
> > > Factory
> > >>  > >>  > >>> <https://javaeefactory-
> > > rmannibucau.rhcloud.com>
> > >>  > >>  > >>>
> > >>  > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> > >>  > > <ka...@hotmail.com>:
> > >>  > >>  > >>>
> > >>  > >>  > >>>>  Hi Romain,
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  I tried with
> > > org.apache.tomcat:tomcat-
> > >>  > > jasper-el:8.5.5 but it does
> > >>  > >>  > not
> > >>  > >>  > >>>>  parse my expression until I change
> > >>  > > ".transient" by
> > >>  > >>  > >>> ".isTransient()" and
> > >>  > >>  > >>>>  then it gives the same error:
> > > javax.el.
> > >>  > > PropertyNotFoundException:
> > >>  > >>  > >>>>  ELResolver cannot handle a null base
> > > Object with
> > >>  > > identifier
> > >>  > >>  > >>> 'javax'.
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  Does the EL context need something
> > > else than adding
> > >>  > > the
> > >>  > >>  > >>>>  BeanManager.getELResolver()  to be
> > > able to resolve
> > >>  > > some implicit
> > >>  > >>  > objects? I
> > >>  > >>  > >>>>  don't understand why it works
> > > with ri-1.0.
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  Xavier
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  From: Romain Manni-Bucau
> > >>  > > <rm...@gmail.com>
> > >>  > >>  > >>>>  Sent: Wednesday, September 28, 2016
> > > 4:02 PM
> > >>  > >>  > >>>>  To: users@tomee.apache.org
> > >>  > >>  > >>>>  Subject: Re: OpenEJB and EL
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  Hi Xavier
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  On the phone so hard to give you a
> > > link bit try
> > >>  > > using tomcat el
> > >>  > >>  impl
> > >>  > >>  > of
> > >>  > >>  > >>>>  tomcat 8.5
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier
> > > Dury"
> > >>  > > <ka...@hotmail.com>
> > >>  > >>  > >>> a écrit :
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>  > Hi,
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > I am using OpenEJB for my tests
> > > and need
> > >>  > > support for EL
> > >>  > >>  > expressions in
> > >>  > >>  > >>> my
> > >>  > >>  > >>>>  > own code.
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > By default, if I do something
> > > like this (pay
> > >>  > > attention to the
> > >>  > >>  > >>>>  expression):
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > ExpressionFactory factory =
> > > beanManager.
> > >>  > > wrapExpressionFactory(
> > >>  > >>  > >>>>  > ExpressionFactory.newInstance(
> > > ));
> > >>  > >>  > >>>>  > StandardELContext elContext =
> > > new
> > >>  > > StandardELContext(factory);
> > >>  > >>  > >>>>  > elContext.addELResolver(
> > >>  > > beanManager.getELResolver());
> > >>  > >>  > >>>>  > ValueExpression expression =
> > >>  > > factory.createValueExpression(
> > >>  > >>  > elContext,
> > >>  > >>  > >>>>  >
> > > "#{javax.enterprise.context.
> > >>  > > conversation.transient}",
> > >>  > >>  > >>> Boolean.class);
> > >>  > >>  > >>>>  > expression.getValue(elContext) ;
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > and only add
> > > org.apache.tomee:openejb-core:
> > >>  > > 7.0.1 to my project
> > >>  > >>  > then I
> > >>  > >>  > >>>>  get
> > >>  > >>  > >>>>  > javax.el.ELException: Unable to
> > > find
> > >>  > > ExpressionFactory of type:
> > >>  > >>  > >>>>  > org.apache.el.
> > > ExpressionFactoryImpl
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > if I add
> > > org.glassfish:javax.el:3.0.0 then I
> > >>  > > get javax.el.
> > >>  > >>  > >>>>  PropertyNotFoundException:
> > >>  > >>  > >>>>  > ELResolver cannot handle a null
> > > base Object
> > >>  > > with identifier
> > >>  > >>  > >>> 'javax'
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > if I switch the EL library to
> > >>  > > com.sun.el:el-ri:1.0 (+
> > >>  > >>  > >>> META-INF/javax.el.
> > >>  > >>  > >>>>  ExpressionFactory
> > >>  > >>  > >>>>  > < com.sun.el.
> > > ExpressionFactoryImpl) then my
> > >>  > > expression can be
> > >>  > >>  > >>> evaluated
> > >>  > >>  > >>>>  > but I can't use any new
> > > feature of 3.0
> > >>  > > (like lambdas)
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > So, either my dependencies are
> > > wrong or I am
> > >>  > > not correctly
> > >>  > >>  > >>> initializing
> > >>  > >>  > >>>>  my
> > >>  > >>  > >>>>  > factory.
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > Does anybody have an idea?
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > Thanks,
> > >>  > >>  > >>>>  >
> > >>  > >>  > >>>>  > Xavier
> > >>  > >>  > >>>>
> > >>  > >>  > >>>>
> > >>  > >>  > >>>
> > >>  > >>  > >>
> > >>  > >>  > >
> > >>  > >>  > >
> > >>  > >>  > >
> > >>  > >>  >
> > >>  > >>  >
> > >>  > >>
> > >>  > >>
> > >>  > >
> > >>  >
> > >>  >
> > >>
> > >>
> > >
> >
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
something like this? https://gist.github.com/kalgon/c1ccffff45540a629314f615b90f944f






From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Thursday, September 29, 2016 11:43 AM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
think it is doable with a custom ELResolver without having to hold this map
which can be wrong for pseudo scoped beans.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-29 11:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Thanks, now I understand better why it is not implemented in OWB.
>
> Funny, I came to the same conclusion and was busy implementing an
> @ApplicationScoped @Named Beans (which implements Map<String, Object> so I
> can do #{beans['javax.enteprise.context.conversation']}.
>
> Xavier
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 10:32 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Yea, now you probably understand my 'oh boy' reaction ;)
>
>
> My initial reaction when discovering this problem back then (a few years
> ago) was to simply replace the dots with underlines ->
> javax_enterprise_context_conversation
>
> But this solution wasn't choosen.
>
>
> The reason why I don't like to implement it in OWB is that CDI is sadly
> _not_ the only spec which defined such. E.g. the Servlet specifies that
> there is a request parameter 'javax.servlet.request.key_size' or
> 'javax.servlet.error.message' and others.
>
> But despite all servlet request parameters are available via an ELResolver
> it is also _not_ possible to simply write "#{javax.servlet.request.key_
> size}".
>
> While in the servlet spec this was primarily targetted to be
> programmatically available from the request attriubute (and EL is only an
> implicit way), it is a 'first class citizen' in CDI. But still doesn't work.
>
> You could provide the following which is probably even more straight
> forward than the producer:
>
>
> @ApplicationScoped
> @Named
> public class NameResolver {
>
>   private @Inject BeanManager bm;
>
>
>   public Object get(String beanName) {
>     Set<Bean> beans = bm.getBeans(beanName);
>     Bean bean = bm.resolve(beans);
>     return bm.getReference(bean, bean.getType() or so,
> bm.createCreationalContext());
>
>   }
> }
>
>
> (of course with null checks etc, just sketched that wo trying).
> That should be available as #{nameResolver.get("javax.enterprise.context.
> conversation")}
>
>
> LieGrue,
> strub
>
> > On Thursday, 29 September 2016, 9:21, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
> > > 2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  Indeed, @Named != named... got it! :-)
> >>
> >>  But I still fail to understand _where_ the workaround for
> > 'javax...' is
> >>  actually implemented:
> >>
> >>
> > nowhere cause it introduces other issues in EL so the workaround is only
> a
> > workaround not a nasty way to get a feature.
> >
> >
> >>  1) if it is implemented in OWB then why is
> > 'elContext.addELResolver(beanManager.getELResolver());'
> >>  not working? I would expect the returned el resolver to contain the
> >>  workaround.
> >>  2) if it is implemented elsewhere (TomEE for example), I don't
> > understand
> >>  why as this requirement comes from the CDI spec and should be
> implemented
> >>  in OWB... so back to (1)
> >>
> >>  I am stuck in an infinite loop ;-)
> >>
> >>
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Thursday, September 29, 2016 8:54 AM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>
> >>  > @Mark
> >>  >
> >>  > thanks, it works when adding any other qualifier!
> >>  >
> >>  > btw, do you think it would hurt to qualify the built-in conversation
> > bean
> >>  > with @Named("javax.enterprise.context.conversation") in OWB?
> > That way I
> >>  > could inject the built-in with @Inject @Named("javax.enteprise.
> >>  context.conversation")
> >>  > and expose it via @Produces @Named("conversation") without
> > resorting to
> >>  > some extra qualifier.
> >>  >
> >>  > @Romain
> >>  >
> >>  > I was wondering where exactly is your hacky el resolver implemented?
> > If
> >>  > the "javax.enterprise.context.conversation" name is a
> > requirement coming
> >>  > from the CDI spec, then I would suppose it is implemented in OWB (in
> > the
> >>  > resolver you get from the BeanManager) but as my tests with OEJB+OWB
> >>  fail,
> >>  > I suppose it is not there (or not enabled in some way). On the
> > contrary,
> >>  if
> >>  > the requirement comes from the java EE spec, then I suppose it is
> >>  > implemented in TomEE and that would explain why my tests fail.
> >>  >
> >>  >
> >>  The name is built it in openwebbeans:
> >>  https://github.com/apache/openwebbeans/blob/trunk/
> >>  webbeans-impl/src/main/java/org/apache/webbeans/component/
> >>  ConversationBean.java#L54
> >>
> >>  The spec states:
> >>
> >>  "The container provides a built-in bean with bean type Conversation,
> > scope
> >>  @RequestScoped, and qualifier@Default, named
> >>  javax.enterprise.context.conversation."
> >>
> >>  So no qualifier @Named but a Bean<?> name (no comment ;))
> >>
> >>
> >>  > Xavier
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > Sent: Thursday, September 29, 2016 12:12 AM
> >>  > To: users@tomee.apache.org
> >>  > Subject: Re: OpenEJB and EL
> >>  >
> >>  > @Default is always assumed when you don't add a specific Qualifier
> > other
> >>  > than @Named and @Any.
> >>  >
> >>  > Xavier, can you please add any random qualifier? E.g. @Destroyed.
> >>  >
> >>  > This will stop CDI from complaining but EL should work.
> >>  >
> >>  > LieGrue,
> >>  > strub
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > > On Thursday, 29 September 2016, 0:04, Xavier Dury
> > <ka...@hotmail.com>
> >>  > wrote:
> >>  > > >
> > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
>
>
>
> OpenEjbElTest.java
> gist.github.com
> property=
> >>
> >>
> >>
> >>  OpenEjbElTest.java
> >>  gist.github.com
> >>  property=
> >>  >
> >>  >
> >>  >
> >>  > OpenEjbElTest.java
> >>  > gist.github.com
> >>  > property=
> >>  > >
> >>  > >
> >>  > >
> >>  > > From: Xavier Dury <ka...@hotmail.com>
> >>  > > Sent: Wednesday, September 28, 2016 11:54 PM
> >>  > > To: users@tomee.apache.org
> >>  > > Subject: Re: OpenEJB and EL
> >>  > >
> >>  > > No, I didn't add the @Default to the @Produces method.
> >>  > >
> >>  > > I verified:
> >>  > >
> >>  > > @RequestScoped
> >>  > > public class ConversationWrapper {
> >>  > >
> >>  > >         private @Inject Conversation conv;
> >>  > >
> >>  > >         @Produces
> >>  > >         @Dependent
> >>  > >         @Named("conv")
> >>  > >         public Conversation getConv() {
> >>  > >                 return conv;
> >>  > >         }
> >>  > > }
> >>  > >
> >>  > > result:
> >>  > >
> >>  > > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> > There
> >>  > is more
> >>  > > than one Bean with type javax.enterprise.context.
> >>  ConversationQualifiers:
> >>  > > [@javax.enterprise.inject.Default()]
> >>  > > for injection into Field Injection Point, field name :  conv,
> > Bean
> >>  Owner
> >>  > :
> >>  > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  > > Types:[java.lang.Object,eg.ConversationWrapper],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > > found beans:
> >>  > > ConversationImpl, WebBeansType:CONVERSATION,
> >>  > > Name:javax.enterprise.context.conversation, API
> >>  > > Types:[java.lang.Object,org.apache.webbeans.conversation.
> >>  > ConversationImpl,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]
> >>  > from
> >>  > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any,javax.inject.Named]
> >>  > > from
> >>  > >
> > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> >>  > ConversationWrapper.class
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > > From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > > Sent: Wednesday, September 28, 2016 11:47 PM
> >>  > > To: users@tomee.apache.org
> >>  > > Subject: Re: OpenEJB and EL
> >>  > >
> >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > > enterprise.inject.Any,javax.inject.Named] from
> > file:/D:/development/
> >>  > >
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >>  > >
> >>  > > Why is there @Default there? producer should only have the @Named
> > you
> >>  set
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau
> >>  > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>  >
> >>  >
> >>  >
> >>  > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > twitter.com
> >>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE)
> >>  /
> >>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > https://t.co/0VnvWwbedt . Blog ...
> >>  > >
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > > twitter.com
> >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> >>  Java(EE)
> >>  > /
> >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > > https://t.co/0VnvWwbedt . Blog ...
> >>  > >
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > > twitter.com
> >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> >>  Java(EE)
> >>  > /
> >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > > https://t.co/0VnvWwbedt . Blog ...
> >>  > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >>  > >
> >>  > >
> >>  > > RBlog: the RManniBucau v2 Blog
> >>  > > blog-rmannibucau.rhcloud.com
> >>  > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > Angular, Open
> >>  > Source,
> >>  > > Code and geeky topics...
> >>  > > <http://rmannibucau.wordpress.com> | Github
> >>  > > <https://github.com/rmannibucau> |
> >>  > >
> >>  > >
> >>  > > [old blog] new RManniBucau().blog()
> >>  > > rmannibucau.wordpress.com
> >>  > > New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > Tomitriber
> >>  > > <http://www.tomitribe.com> | JavaEE Factory
> >>  > > <https://javaeefactory-rmannibucau.rhcloud.com>
> >>  > >
> >>  > > 2016-09-28 23:45 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >
> >>  > >>  It seems that to inject the conversation in
> >>  > > ConversationWrapper.conversation,
> >>  > >>  OWB does consider both the build-in conversation bean and
> > the
> >>  produced
> >>  > one
> >>  > >>  from... ConversationWrapper.getConv().
> >>  > >>
> >>  > >>  I tried something like that:
> >>  > >>
> >>  > >>  @RequestScoped
> >>  > >>  public class ConversationWrapper {
> >>  > >>
> >>  > >>          private @Inject
> >>  > > @Named("javax.enterprise.context.conversation")
> >>  > >>  Conversation conv;
> >>  > >>
> >>  > >>          @Produces
> >>  > >>          @Dependent
> >>  > >>          @Named("conv")
> >>  > >>          public Conversation getConv() {
> >>  > >>                  return conv;
> >>  > >>          }
> >>  > >>  }
> >>  > >>
> >>  > >>  But it gives the following error:
> >>  > >>
> >>  > >>  Caused by:
> > javax.enterprise.inject.UnsatisfiedResolutionException:
> >>  Api
> >>  > >>  type [javax.enterprise.context.Conversation] is not found
> > with the
> >>  > >>  qualifiers
> >>  > >>  Qualifiers:
> > [@javax.inject.Named(value=javax.enterprise.context.
> >>  > >>  conversation)]
> >>  > >>  for injection into Field Injection Point, field name :
> > conv, Bean
> >>  > Owner :
> >>  > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  > >>  Types:[eg.ConversationWrapper,java.lang.Object],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  From: Xavier Dury <ka...@hotmail.com>
> >>  > >>  Sent: Wednesday, September 28, 2016 11:34 PM
> >>  > >>  To: users@tomee.apache.org
> >>  > >>  Subject: Re: OpenEJB and EL
> >>  > >>
> >>  > >>  Got the same result with 'conv':
> >>  > >>
> >>  > >>  Caused by:
> > javax.enterprise.inject.AmbiguousResolutionException:
> >>  > There is
> >>  > >>  more than one Bean with type
> >>  > > javax.enterprise.context.ConversationQualifiers:
> >>  > >>  [@javax.enterprise.inject.Default()]
> >>  > >>  for injection into Field Injection Point, field name :
> > conversation,
> >>  > Bean
> >>  > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > Name:null, API
> >>  > >>  Types:[java.lang.Object,eg.ConversationAliaser],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > >>  found beans:
> >>  > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > >>
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  enterprise.inject.Any,javax.inject.Named] from
> > file:/D:/development/
> >>  > >>  workspaces/openejb-el/target/test-classes/eg/
> >>  ConversationWrapper.class
> >>  > >>  ConversationImpl, WebBeansType:CONVERSATION,
> >>  > > Name:javax.enterprise.context.conversation,
> >>  > >>  API
> > Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > >>  javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]
> >>  > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > >>
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > >>  Sent: Wednesday, September 28, 2016 11:29 PM
> >>  > >>  To: users@tomee.apache.org
> >>  > >>  Cc: Mark Struberg
> >>  > >>  Subject: Re: OpenEJB and EL
> >>  > >>
> >>  > >>  missing @Named("conv")?
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau
> >>  > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>  twitter.com
> >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>  twitter.com
> >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> >>  > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress
> > Blog
> >>  > >>
> >>  > >>
> >>  > >>  RBlog: the RManniBucau v2 Blog
> >>  > >>  blog-rmannibucau.rhcloud.com
> >>  > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > Angular,
> >>  Open
> >>  > >>  Source, Code and geeky topics...
> >>  > >>  <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/
> >>  > >>  rmannibucau> |
> >>  > >>
> >>  > >>
> >>  > >>  [old blog] new RManniBucau().blog()
> >>  > >>  rmannibucau.wordpress.com
> >>  > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > Tomitriber
> >>  > >>  <http://www.tomitribe.com> | JavaEE Factory
> >>  > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> >>  > >>
> >>  > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >>
> >>  > >>  >
> >>  > >>  > Caused by:
> > javax.enterprise.inject.AmbiguousResolutionException:
> >>  > There
> >>  > >>  is
> >>  > >>  > more than one Bean with type javax.enterprise.context.
> >>  > >>  ConversationQualifiers:
> >>  > >>  > [@javax.enterprise.inject.Default()]
> >>  > >>  > for injection into Field Injection Point, field name :
> >>  conversation,
> >>  > >>  Bean
> >>  > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > Name:null, API
> >>  > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  enterprise.inject.Any]]
> >>  > >>  > found beans:
> >>  > >>  > Conversation, WebBeansType:PRODUCERMETHOD,
> > Name:conversation, API
> >>  > >>  >
> > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  > enterprise.inject.Any,javax.inject.Named] from
> >>  file:/D:/development/
> >>  > >>  > workspaces/openejb-el/target/test-classes/eg/
> >>  > ConversationWrapper.class
> >>  > >>  > ConversationImpl, WebBeansType:CONVERSATION,
> >>  > >>  Name:javax.enterprise.context.conversation,
> >>  > >>  > API
> > Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > >>  >
> > javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  >
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]
> >>  > >>  > from
> > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > >>  >
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> >>  > >>  > To: users@tomee.apache.org
> >>  > >>  > Subject: Re: OpenEJB and EL
> >>  > >>  >
> >>  > >>  > +1
> >>  > >>  >
> >>  > >>  > means
> >>  > >>  >
> >>  > >>  > @RequestScoped
> >>  > >>  >
> >>  > >>  > public class ConversationWrapper {
> >>  > >>  >   private @Inject Conversation conv;
> >>  > >>  >
> >>  > >>  >   @Produces
> >>  > >>  >   @Dependent
> >>  > >>  >   @Named("conv")
> >>  > >>  >
> >>  > >>  >   public Conversation getConv() {
> >>  > >>  >     return conv;
> >>  > >>  >   }
> >>  > >>  > }
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > On Wednesday, 28 September 2016, 23:10, Romain
> > Manni-Bucau <
> >>  > >>  > rmannibucau@gmail.com> wrote:
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >a producer allows to get a shorter/more elegant
> > naming like
> >>  > > #{conv.id}
> >>  > >>  > if you @Produces @Named("conv") ;)
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >Romain Manni-Bucau
> >>  > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github
> > | LinkedIn |
> >>  > >>  > Tomitriber | JavaEE Factory
> >>  > >>  > >
> >>  > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> >>  > > <st...@yahoo.de.invalid>:
> >>  > >>  > >
> >>  > >>  > >Oh boy, sorry for you. You did hit a blank spot in
> > the CDI spec.
> >>  > >>  > >>
> >>  > >>  > >>Problem is that the EE umbrella spec, the EL
> > spec and the CDI
> >>  > > spec
> >>  > >>  > contradict each other.
> >>  > >>  > >>
> >>  > >>  > >>The Weld guys solved this by introducing a
> > Javax class. But
> >>  > > that takes
> >>  > >>  > away the whole javax.* tree for the EL. That's just
> > not good as it
> >>  > >>  > contradicts the EL spec.
> >>  > >>  > >>
> >>  > >>  > >>Could you please try the following
> >>  > >>  > >>
> >>  > >>  > >>@RequestScoped
> >>  > >>  > >>@Named("conversation")
> >>  > >>  > >>public class ConversationWrapper {
> >>  > >>  > >>   private @Inject Conversation conv;
> >>  > >>  > >>
> >>  > >>  > >>  public Conversation get() {
> >>  > >>  > >>       return conv;
> >>  > >>  > >>   }
> >>  > >>  > >>}
> >>  > >>  > >>
> >>  > >>  > >>And in the EL just use
> > #{conversation.get.id}
> >>  > >>  > >>
> >>  > >>  > >>LieGrue,
> >>  > >>  > >>strub
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>> On Wednesday, 28 September 2016, 22:12,
> > Xavier Dury <
> >>  > >>  > kalgon@hotmail.com> wrote:
> >>  > >>  > >>> > I really don't understand how
> > something like
> >>  > > <f:param
> >>  > >>  > >>> name="cid"
> >>  > >>  > >>> value="#{javax.enterprise.
> >>  > > context.conversation.id}"/> actually
> >>  > >>  > >>> works... something must be made to make
> > the EL processor
> >>  > > accept that
> >>  > >>  > invalid
> >>  > >>  > >>> bean name.
> >>  > >>  > >>>
> >>  > >>  > >>> Making a producer which @Produces @Named
> > Conversation
> >>  > > conflicts with
> >>  > >>  > the
> >>  > >>  > >>> built-in bean from OWB (with
> > WebBeanType.CONVERSATION)...
> >>  > >>  > >>>
> >>  > >>  > >>> ... so, I have done the following for my
> > tests but I feel
> >>  > > a bit
> >>  > >>  > ashamed because
> >>  > >>  > >>> I can't imagine there is no better
> > solution than this
> >>  > > ;-)
> >>  > >>  > >>>
> >>  > >>  > >>> public class ConversationAliaser {
> >>  > >>  > >>>     public class Javax {
> >>  > >>  > >>>         public Enterprise getEnterprise()
> > {return
> >>  > > new Enterprise();}
> >>  > >>  > >>>
> >>  > >>  > >>>     }
> >>  > >>  > >>>     public class Enterprise {
> >>  > >>  > >>>         public Context getContext()
> > {return new
> >>  > > Context();}
> >>  > >>  > >>>     }
> >>  > >>  > >>>     public class Context {
> >>  > >>  > >>>         public Conversation
> > getConversation()
> >>  > > {return conversation;}
> >>  > >>  > >>>
> >>  > >>  > >>>     }
> >>  > >>  > >>>     @Inject
> >>  > >>  > >>>     private Conversation conversation;
> >>  > >>  > >>>     @Produces @ApplicationScoped
> >>  > > @Named("javax")
> >>  > >>  > >>>     public Javax javax() {return new
> > Javax();}
> >>  > >>  > >>> }
> >>  > >>  > >>>
> >>  > >>  > >>> But that works!
> >>  > >>  > >>>
> >>  > >>  > >>> Xavier
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> From: Xavier Dury
> > <ka...@hotmail.com>
> >>  > >>  > >>> Sent: Wednesday, September 28, 2016 8:42
> > PM
> >>  > >>  > >>> To: users@tomee.apache.org
> >>  > >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>  > >>>
> >>  > >>  > >>> Hmmm... I guess I'll have to @Produces
> > @Named the
> >>  > > conversation if I
> >>  > >>  > want to
> >>  > >>  > >>> use it in ELs. I don't know if
> > something like
> >>  > >>  > >>> #{applicationScope['javax.
> > enterprise.context.
> >>  > >>  > conversation'].transient}
> >>  > >>  > >>> would work?
> >>  > >>  > >>>
> >>  > >>  > >>> I remember back in my JSP days that,
> > sometimes, I had to
> >>  > > use
> >>  > >>  something
> >>  > >>  > like
> >>  > >>  > >>> ${requestScope['javax.servlet.
> >>  > > forward.request_uri']} instead of
> >>  > >>  > >>> plain ${javax.servlet.forward.
> > request_uri}.
> >>  > >>  > >>>
> >>  > >>  > >>> Xavier
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> From: Romain Manni-Bucau
> > <rm...@gmail.com>
> >>  > >>  > >>> Sent: Wednesday, September 28, 2016 6:54
> > PM
> >>  > >>  > >>> To: users@tomee.apache.org
> >>  > >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>  > >>>
> >>  > >>  > >>> hmm, wonder if it is linked to the value
> > you try to
> >>  > > evaluate (which
> >>  > >>  > doesn't
> >>  > >>  > >>> respect EL spec even if in CDI spec -
> > don't ask
> >>  > > please ;)).. See
> >>  > >>  > >>> https://issues.jboss.org/
> > browse/CDITCK-462 /
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > System Dashboard - JBoss Issue Tracker
> >>  > >>  > issues.jboss.org
> >>  > >>  > Atlassian JIRA Project Management Software
> >>  > > (v6.4.11#64026-sha1:78f6ec4)
> >>  > >>  > About JIRA; Report a problem; Powered by a free
> > Atlassian JIRA open
> >>  > >>  source
> >>  > >>  > license for Red Hat ...
> >>  > >>  > >>> http://lists.jboss.org/
> > pipermail/cdi-dev/2015-
> >>  > > January/006009.html
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > lists.jboss.org Mailing Lists
> >>  > >>  > lists.jboss.org
> >>  > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a
> > listing of all
> >>  > the
> >>  > >>  > public mailing lists on lists.jboss.org. Click on a
> > list name to
> >>  get
> >>  > >>  more
> >>  > >>  > information ...
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> Romain Manni-Bucau
> >>  > >>  > >>> @rmannibucau <https://twitter.com/
> > rmannibucau> |
> >>  > > Blog
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> Romain Manni-Bucau (@rmannibucau) |
> > Twitter
> >>  > >>  > >>> twitter.com
> >>  > >>  > >>> The latest Tweets from Romain Manni-Bucau
> > (@rmannibucau).
> >>  > > ASF /
> >>  > >>  > Java(EE) /
> >>  > >>  > >>> Angular. LinkedIn:
> > https://t.co/dX7XMGjbBi. JavaEE
> >>  > > Factory:
> >>  > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> >>  > >>  > >>> <https://blog-rmannibucau.
> > rhcloud.com> | Old
> >>  > > Wordpress Blog
> >>  > >>  > >>> <http://rmannibucau.wordpress. com>
> > | Github
> >>  > >>  > >>> <https://github.com/ rmannibucau> |
> >>  > >>  > >>> LinkedIn <https://www.linkedin.com/in/
> > rmannibucau>
> >>  > > | Tomitriber
> >>  > >>  > >>> <http://www.tomitribe.com> | JavaEE
> > Factory
> >>  > >>  > >>> <https://javaeefactory-
> > rmannibucau.rhcloud.com>
> >>  > >>  > >>>
> >>  > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> >>  > > <ka...@hotmail.com>:
> >>  > >>  > >>>
> >>  > >>  > >>>>  Hi Romain,
> >>  > >>  > >>>>
> >>  > >>  > >>>>  I tried with
> > org.apache.tomcat:tomcat-
> >>  > > jasper-el:8.5.5 but it does
> >>  > >>  > not
> >>  > >>  > >>>>  parse my expression until I change
> >>  > > ".transient" by
> >>  > >>  > >>> ".isTransient()" and
> >>  > >>  > >>>>  then it gives the same error:
> > javax.el.
> >>  > > PropertyNotFoundException:
> >>  > >>  > >>>>  ELResolver cannot handle a null base
> > Object with
> >>  > > identifier
> >>  > >>  > >>> 'javax'.
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Does the EL context need something
> > else than adding
> >>  > > the
> >>  > >>  > >>>>  BeanManager.getELResolver()  to be
> > able to resolve
> >>  > > some implicit
> >>  > >>  > objects? I
> >>  > >>  > >>>>  don't understand why it works
> > with ri-1.0.
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>
> >>  > >>  > >>>>  From: Romain Manni-Bucau
> >>  > > <rm...@gmail.com>
> >>  > >>  > >>>>  Sent: Wednesday, September 28, 2016
> > 4:02 PM
> >>  > >>  > >>>>  To: users@tomee.apache.org
> >>  > >>  > >>>>  Subject: Re: OpenEJB and EL
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Hi Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>  On the phone so hard to give you a
> > link bit try
> >>  > > using tomcat el
> >>  > >>  impl
> >>  > >>  > of
> >>  > >>  > >>>>  tomcat 8.5
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier
> > Dury"
> >>  > > <ka...@hotmail.com>
> >>  > >>  > >>> a écrit :
> >>  > >>  > >>>>
> >>  > >>  > >>>>  > Hi,
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > I am using OpenEJB for my tests
> > and need
> >>  > > support for EL
> >>  > >>  > expressions in
> >>  > >>  > >>> my
> >>  > >>  > >>>>  > own code.
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > By default, if I do something
> > like this (pay
> >>  > > attention to the
> >>  > >>  > >>>>  expression):
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > ExpressionFactory factory =
> > beanManager.
> >>  > > wrapExpressionFactory(
> >>  > >>  > >>>>  > ExpressionFactory.newInstance(
> > ));
> >>  > >>  > >>>>  > StandardELContext elContext =
> > new
> >>  > > StandardELContext(factory);
> >>  > >>  > >>>>  > elContext.addELResolver(
> >>  > > beanManager.getELResolver());
> >>  > >>  > >>>>  > ValueExpression expression =
> >>  > > factory.createValueExpression(
> >>  > >>  > elContext,
> >>  > >>  > >>>>  >
> > "#{javax.enterprise.context.
> >>  > > conversation.transient}",
> >>  > >>  > >>> Boolean.class);
> >>  > >>  > >>>>  > expression.getValue(elContext) ;
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > and only add
> > org.apache.tomee:openejb-core:
> >>  > > 7.0.1 to my project
> >>  > >>  > then I
> >>  > >>  > >>>>  get
> >>  > >>  > >>>>  > javax.el.ELException: Unable to
> > find
> >>  > > ExpressionFactory of type:
> >>  > >>  > >>>>  > org.apache.el.
> > ExpressionFactoryImpl
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > if I add
> > org.glassfish:javax.el:3.0.0 then I
> >>  > > get javax.el.
> >>  > >>  > >>>>  PropertyNotFoundException:
> >>  > >>  > >>>>  > ELResolver cannot handle a null
> > base Object
> >>  > > with identifier
> >>  > >>  > >>> 'javax'
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > if I switch the EL library to
> >>  > > com.sun.el:el-ri:1.0 (+
> >>  > >>  > >>> META-INF/javax.el.
> >>  > >>  > >>>>  ExpressionFactory
> >>  > >>  > >>>>  > < com.sun.el.
> > ExpressionFactoryImpl) then my
> >>  > > expression can be
> >>  > >>  > >>> evaluated
> >>  > >>  > >>>>  > but I can't use any new
> > feature of 3.0
> >>  > > (like lambdas)
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > So, either my dependencies are
> > wrong or I am
> >>  > > not correctly
> >>  > >>  > >>> initializing
> >>  > >>  > >>>>  my
> >>  > >>  > >>>>  > factory.
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Does anybody have an idea?
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Thanks,
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>
> >>  > >>  > >>>
> >>  > >>  > >>
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>  >
> >>  > >>
> >>  > >>
> >>  > >
> >>  >
> >>  >
> >>
> >>
> >
>
>
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
think it is doable with a custom ELResolver without having to hold this map
which can be wrong for pseudo scoped beans.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-29 11:38 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Thanks, now I understand better why it is not implemented in OWB.
>
> Funny, I came to the same conclusion and was busy implementing an
> @ApplicationScoped @Named Beans (which implements Map<String, Object> so I
> can do #{beans['javax.enteprise.context.conversation']}.
>
> Xavier
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 10:32 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Yea, now you probably understand my 'oh boy' reaction ;)
>
>
> My initial reaction when discovering this problem back then (a few years
> ago) was to simply replace the dots with underlines ->
> javax_enterprise_context_conversation
>
> But this solution wasn't choosen.
>
>
> The reason why I don't like to implement it in OWB is that CDI is sadly
> _not_ the only spec which defined such. E.g. the Servlet specifies that
> there is a request parameter 'javax.servlet.request.key_size' or
> 'javax.servlet.error.message' and others.
>
> But despite all servlet request parameters are available via an ELResolver
> it is also _not_ possible to simply write "#{javax.servlet.request.key_
> size}".
>
> While in the servlet spec this was primarily targetted to be
> programmatically available from the request attriubute (and EL is only an
> implicit way), it is a 'first class citizen' in CDI. But still doesn't work.
>
> You could provide the following which is probably even more straight
> forward than the producer:
>
>
> @ApplicationScoped
> @Named
> public class NameResolver {
>
>   private @Inject BeanManager bm;
>
>
>   public Object get(String beanName) {
>     Set<Bean> beans = bm.getBeans(beanName);
>     Bean bean = bm.resolve(beans);
>     return bm.getReference(bean, bean.getType() or so,
> bm.createCreationalContext());
>
>   }
> }
>
>
> (of course with null checks etc, just sketched that wo trying).
> That should be available as #{nameResolver.get("javax.enterprise.context.
> conversation")}
>
>
> LieGrue,
> strub
>
> > On Thursday, 29 September 2016, 9:21, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
> > > 2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  Indeed, @Named != named... got it! :-)
> >>
> >>  But I still fail to understand _where_ the workaround for
> > 'javax...' is
> >>  actually implemented:
> >>
> >>
> > nowhere cause it introduces other issues in EL so the workaround is only
> a
> > workaround not a nasty way to get a feature.
> >
> >
> >>  1) if it is implemented in OWB then why is
> > 'elContext.addELResolver(beanManager.getELResolver());'
> >>  not working? I would expect the returned el resolver to contain the
> >>  workaround.
> >>  2) if it is implemented elsewhere (TomEE for example), I don't
> > understand
> >>  why as this requirement comes from the CDI spec and should be
> implemented
> >>  in OWB... so back to (1)
> >>
> >>  I am stuck in an infinite loop ;-)
> >>
> >>
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Thursday, September 29, 2016 8:54 AM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>
> >>  > @Mark
> >>  >
> >>  > thanks, it works when adding any other qualifier!
> >>  >
> >>  > btw, do you think it would hurt to qualify the built-in conversation
> > bean
> >>  > with @Named("javax.enterprise.context.conversation") in OWB?
> > That way I
> >>  > could inject the built-in with @Inject @Named("javax.enteprise.
> >>  context.conversation")
> >>  > and expose it via @Produces @Named("conversation") without
> > resorting to
> >>  > some extra qualifier.
> >>  >
> >>  > @Romain
> >>  >
> >>  > I was wondering where exactly is your hacky el resolver implemented?
> > If
> >>  > the "javax.enterprise.context.conversation" name is a
> > requirement coming
> >>  > from the CDI spec, then I would suppose it is implemented in OWB (in
> > the
> >>  > resolver you get from the BeanManager) but as my tests with OEJB+OWB
> >>  fail,
> >>  > I suppose it is not there (or not enabled in some way). On the
> > contrary,
> >>  if
> >>  > the requirement comes from the java EE spec, then I suppose it is
> >>  > implemented in TomEE and that would explain why my tests fail.
> >>  >
> >>  >
> >>  The name is built it in openwebbeans:
> >>  https://github.com/apache/openwebbeans/blob/trunk/
> >>  webbeans-impl/src/main/java/org/apache/webbeans/component/
> >>  ConversationBean.java#L54
> >>
> >>  The spec states:
> >>
> >>  "The container provides a built-in bean with bean type Conversation,
> > scope
> >>  @RequestScoped, and qualifier@Default, named
> >>  javax.enterprise.context.conversation."
> >>
> >>  So no qualifier @Named but a Bean<?> name (no comment ;))
> >>
> >>
> >>  > Xavier
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > Sent: Thursday, September 29, 2016 12:12 AM
> >>  > To: users@tomee.apache.org
> >>  > Subject: Re: OpenEJB and EL
> >>  >
> >>  > @Default is always assumed when you don't add a specific Qualifier
> > other
> >>  > than @Named and @Any.
> >>  >
> >>  > Xavier, can you please add any random qualifier? E.g. @Destroyed.
> >>  >
> >>  > This will stop CDI from complaining but EL should work.
> >>  >
> >>  > LieGrue,
> >>  > strub
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > > On Thursday, 29 September 2016, 0:04, Xavier Dury
> > <ka...@hotmail.com>
> >>  > wrote:
> >>  > > >
> > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
>
>
>
> OpenEjbElTest.java
> gist.github.com
> property=
> >>
> >>
> >>
> >>  OpenEjbElTest.java
> >>  gist.github.com
> >>  property=
> >>  >
> >>  >
> >>  >
> >>  > OpenEjbElTest.java
> >>  > gist.github.com
> >>  > property=
> >>  > >
> >>  > >
> >>  > >
> >>  > > From: Xavier Dury <ka...@hotmail.com>
> >>  > > Sent: Wednesday, September 28, 2016 11:54 PM
> >>  > > To: users@tomee.apache.org
> >>  > > Subject: Re: OpenEJB and EL
> >>  > >
> >>  > > No, I didn't add the @Default to the @Produces method.
> >>  > >
> >>  > > I verified:
> >>  > >
> >>  > > @RequestScoped
> >>  > > public class ConversationWrapper {
> >>  > >
> >>  > >         private @Inject Conversation conv;
> >>  > >
> >>  > >         @Produces
> >>  > >         @Dependent
> >>  > >         @Named("conv")
> >>  > >         public Conversation getConv() {
> >>  > >                 return conv;
> >>  > >         }
> >>  > > }
> >>  > >
> >>  > > result:
> >>  > >
> >>  > > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> > There
> >>  > is more
> >>  > > than one Bean with type javax.enterprise.context.
> >>  ConversationQualifiers:
> >>  > > [@javax.enterprise.inject.Default()]
> >>  > > for injection into Field Injection Point, field name :  conv,
> > Bean
> >>  Owner
> >>  > :
> >>  > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  > > Types:[java.lang.Object,eg.ConversationWrapper],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > > found beans:
> >>  > > ConversationImpl, WebBeansType:CONVERSATION,
> >>  > > Name:javax.enterprise.context.conversation, API
> >>  > > Types:[java.lang.Object,org.apache.webbeans.conversation.
> >>  > ConversationImpl,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]
> >>  > from
> >>  > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any,javax.inject.Named]
> >>  > > from
> >>  > >
> > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> >>  > ConversationWrapper.class
> >>  > >
> >>  > >
> >>  > >
> >>  > >
> >>  > > From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > > Sent: Wednesday, September 28, 2016 11:47 PM
> >>  > > To: users@tomee.apache.org
> >>  > > Subject: Re: OpenEJB and EL
> >>  > >
> >>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > > enterprise.inject.Any,javax.inject.Named] from
> > file:/D:/development/
> >>  > >
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >>  > >
> >>  > > Why is there @Default there? producer should only have the @Named
> > you
> >>  set
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau
> >>  > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>  >
> >>  >
> >>  >
> >>  > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > twitter.com
> >>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE)
> >>  /
> >>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > https://t.co/0VnvWwbedt . Blog ...
> >>  > >
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > > twitter.com
> >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> >>  Java(EE)
> >>  > /
> >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > > https://t.co/0VnvWwbedt . Blog ...
> >>  > >
> >>  > >
> >>  > >
> >>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > > twitter.com
> >>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> >>  Java(EE)
> >>  > /
> >>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > > https://t.co/0VnvWwbedt . Blog ...
> >>  > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >>  > >
> >>  > >
> >>  > > RBlog: the RManniBucau v2 Blog
> >>  > > blog-rmannibucau.rhcloud.com
> >>  > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > Angular, Open
> >>  > Source,
> >>  > > Code and geeky topics...
> >>  > > <http://rmannibucau.wordpress.com> | Github
> >>  > > <https://github.com/rmannibucau> |
> >>  > >
> >>  > >
> >>  > > [old blog] new RManniBucau().blog()
> >>  > > rmannibucau.wordpress.com
> >>  > > New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > Tomitriber
> >>  > > <http://www.tomitribe.com> | JavaEE Factory
> >>  > > <https://javaeefactory-rmannibucau.rhcloud.com>
> >>  > >
> >>  > > 2016-09-28 23:45 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >
> >>  > >>  It seems that to inject the conversation in
> >>  > > ConversationWrapper.conversation,
> >>  > >>  OWB does consider both the build-in conversation bean and
> > the
> >>  produced
> >>  > one
> >>  > >>  from... ConversationWrapper.getConv().
> >>  > >>
> >>  > >>  I tried something like that:
> >>  > >>
> >>  > >>  @RequestScoped
> >>  > >>  public class ConversationWrapper {
> >>  > >>
> >>  > >>          private @Inject
> >>  > > @Named("javax.enterprise.context.conversation")
> >>  > >>  Conversation conv;
> >>  > >>
> >>  > >>          @Produces
> >>  > >>          @Dependent
> >>  > >>          @Named("conv")
> >>  > >>          public Conversation getConv() {
> >>  > >>                  return conv;
> >>  > >>          }
> >>  > >>  }
> >>  > >>
> >>  > >>  But it gives the following error:
> >>  > >>
> >>  > >>  Caused by:
> > javax.enterprise.inject.UnsatisfiedResolutionException:
> >>  Api
> >>  > >>  type [javax.enterprise.context.Conversation] is not found
> > with the
> >>  > >>  qualifiers
> >>  > >>  Qualifiers:
> > [@javax.inject.Named(value=javax.enterprise.context.
> >>  > >>  conversation)]
> >>  > >>  for injection into Field Injection Point, field name :
> > conv, Bean
> >>  > Owner :
> >>  > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  > >>  Types:[eg.ConversationWrapper,java.lang.Object],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  From: Xavier Dury <ka...@hotmail.com>
> >>  > >>  Sent: Wednesday, September 28, 2016 11:34 PM
> >>  > >>  To: users@tomee.apache.org
> >>  > >>  Subject: Re: OpenEJB and EL
> >>  > >>
> >>  > >>  Got the same result with 'conv':
> >>  > >>
> >>  > >>  Caused by:
> > javax.enterprise.inject.AmbiguousResolutionException:
> >>  > There is
> >>  > >>  more than one Bean with type
> >>  > > javax.enterprise.context.ConversationQualifiers:
> >>  > >>  [@javax.enterprise.inject.Default()]
> >>  > >>  for injection into Field Injection Point, field name :
> > conversation,
> >>  > Bean
> >>  > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > Name:null, API
> >>  > >>  Types:[java.lang.Object,eg.ConversationAliaser],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]]
> >>  > >>  found beans:
> >>  > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  > >>
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  enterprise.inject.Any,javax.inject.Named] from
> > file:/D:/development/
> >>  > >>  workspaces/openejb-el/target/test-classes/eg/
> >>  ConversationWrapper.class
> >>  > >>  ConversationImpl, WebBeansType:CONVERSATION,
> >>  > > Name:javax.enterprise.context.conversation,
> >>  > >>  API
> > Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > >>  javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any]
> >>  > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > >>
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > >>  Sent: Wednesday, September 28, 2016 11:29 PM
> >>  > >>  To: users@tomee.apache.org
> >>  > >>  Cc: Mark Struberg
> >>  > >>  Subject: Re: OpenEJB and EL
> >>  > >>
> >>  > >>  missing @Named("conv")?
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau
> >>  > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>  twitter.com
> >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>  twitter.com
> >>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  > >>  https://t.co/0VnvWwbedt . Blog ...
> >>  > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress
> > Blog
> >>  > >>
> >>  > >>
> >>  > >>  RBlog: the RManniBucau v2 Blog
> >>  > >>  blog-rmannibucau.rhcloud.com
> >>  > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE,
> > Angular,
> >>  Open
> >>  > >>  Source, Code and geeky topics...
> >>  > >>  <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/
> >>  > >>  rmannibucau> |
> >>  > >>
> >>  > >>
> >>  > >>  [old blog] new RManniBucau().blog()
> >>  > >>  rmannibucau.wordpress.com
> >>  > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > Tomitriber
> >>  > >>  <http://www.tomitribe.com> | JavaEE Factory
> >>  > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> >>  > >>
> >>  > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >>
> >>  > >>  >
> >>  > >>  > Caused by:
> > javax.enterprise.inject.AmbiguousResolutionException:
> >>  > There
> >>  > >>  is
> >>  > >>  > more than one Bean with type javax.enterprise.context.
> >>  > >>  ConversationQualifiers:
> >>  > >>  > [@javax.enterprise.inject.Default()]
> >>  > >>  > for injection into Field Injection Point, field name :
> >>  conversation,
> >>  > >>  Bean
> >>  > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED,
> > Name:null, API
> >>  > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  enterprise.inject.Any]]
> >>  > >>  > found beans:
> >>  > >>  > Conversation, WebBeansType:PRODUCERMETHOD,
> > Name:conversation, API
> >>  > >>  >
> > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > >>  > enterprise.inject.Any,javax.inject.Named] from
> >>  file:/D:/development/
> >>  > >>  > workspaces/openejb-el/target/test-classes/eg/
> >>  > ConversationWrapper.class
> >>  > >>  > ConversationImpl, WebBeansType:CONVERSATION,
> >>  > >>  Name:javax.enterprise.context.conversation,
> >>  > >>  > API
> > Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > >>  >
> > javax.enterprise.context.Conversation,java.lang.Object],
> >>  > >>  >
> >>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]
> >>  > >>  > from
> > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > >>  >
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> >>  > >>  > To: users@tomee.apache.org
> >>  > >>  > Subject: Re: OpenEJB and EL
> >>  > >>  >
> >>  > >>  > +1
> >>  > >>  >
> >>  > >>  > means
> >>  > >>  >
> >>  > >>  > @RequestScoped
> >>  > >>  >
> >>  > >>  > public class ConversationWrapper {
> >>  > >>  >   private @Inject Conversation conv;
> >>  > >>  >
> >>  > >>  >   @Produces
> >>  > >>  >   @Dependent
> >>  > >>  >   @Named("conv")
> >>  > >>  >
> >>  > >>  >   public Conversation getConv() {
> >>  > >>  >     return conv;
> >>  > >>  >   }
> >>  > >>  > }
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > On Wednesday, 28 September 2016, 23:10, Romain
> > Manni-Bucau <
> >>  > >>  > rmannibucau@gmail.com> wrote:
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >a producer allows to get a shorter/more elegant
> > naming like
> >>  > > #{conv.id}
> >>  > >>  > if you @Produces @Named("conv") ;)
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >Romain Manni-Bucau
> >>  > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github
> > | LinkedIn |
> >>  > >>  > Tomitriber | JavaEE Factory
> >>  > >>  > >
> >>  > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> >>  > > <st...@yahoo.de.invalid>:
> >>  > >>  > >
> >>  > >>  > >Oh boy, sorry for you. You did hit a blank spot in
> > the CDI spec.
> >>  > >>  > >>
> >>  > >>  > >>Problem is that the EE umbrella spec, the EL
> > spec and the CDI
> >>  > > spec
> >>  > >>  > contradict each other.
> >>  > >>  > >>
> >>  > >>  > >>The Weld guys solved this by introducing a
> > Javax class. But
> >>  > > that takes
> >>  > >>  > away the whole javax.* tree for the EL. That's just
> > not good as it
> >>  > >>  > contradicts the EL spec.
> >>  > >>  > >>
> >>  > >>  > >>Could you please try the following
> >>  > >>  > >>
> >>  > >>  > >>@RequestScoped
> >>  > >>  > >>@Named("conversation")
> >>  > >>  > >>public class ConversationWrapper {
> >>  > >>  > >>   private @Inject Conversation conv;
> >>  > >>  > >>
> >>  > >>  > >>  public Conversation get() {
> >>  > >>  > >>       return conv;
> >>  > >>  > >>   }
> >>  > >>  > >>}
> >>  > >>  > >>
> >>  > >>  > >>And in the EL just use
> > #{conversation.get.id}
> >>  > >>  > >>
> >>  > >>  > >>LieGrue,
> >>  > >>  > >>strub
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>
> >>  > >>  > >>> On Wednesday, 28 September 2016, 22:12,
> > Xavier Dury <
> >>  > >>  > kalgon@hotmail.com> wrote:
> >>  > >>  > >>> > I really don't understand how
> > something like
> >>  > > <f:param
> >>  > >>  > >>> name="cid"
> >>  > >>  > >>> value="#{javax.enterprise.
> >>  > > context.conversation.id}"/> actually
> >>  > >>  > >>> works... something must be made to make
> > the EL processor
> >>  > > accept that
> >>  > >>  > invalid
> >>  > >>  > >>> bean name.
> >>  > >>  > >>>
> >>  > >>  > >>> Making a producer which @Produces @Named
> > Conversation
> >>  > > conflicts with
> >>  > >>  > the
> >>  > >>  > >>> built-in bean from OWB (with
> > WebBeanType.CONVERSATION)...
> >>  > >>  > >>>
> >>  > >>  > >>> ... so, I have done the following for my
> > tests but I feel
> >>  > > a bit
> >>  > >>  > ashamed because
> >>  > >>  > >>> I can't imagine there is no better
> > solution than this
> >>  > > ;-)
> >>  > >>  > >>>
> >>  > >>  > >>> public class ConversationAliaser {
> >>  > >>  > >>>     public class Javax {
> >>  > >>  > >>>         public Enterprise getEnterprise()
> > {return
> >>  > > new Enterprise();}
> >>  > >>  > >>>
> >>  > >>  > >>>     }
> >>  > >>  > >>>     public class Enterprise {
> >>  > >>  > >>>         public Context getContext()
> > {return new
> >>  > > Context();}
> >>  > >>  > >>>     }
> >>  > >>  > >>>     public class Context {
> >>  > >>  > >>>         public Conversation
> > getConversation()
> >>  > > {return conversation;}
> >>  > >>  > >>>
> >>  > >>  > >>>     }
> >>  > >>  > >>>     @Inject
> >>  > >>  > >>>     private Conversation conversation;
> >>  > >>  > >>>     @Produces @ApplicationScoped
> >>  > > @Named("javax")
> >>  > >>  > >>>     public Javax javax() {return new
> > Javax();}
> >>  > >>  > >>> }
> >>  > >>  > >>>
> >>  > >>  > >>> But that works!
> >>  > >>  > >>>
> >>  > >>  > >>> Xavier
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> From: Xavier Dury
> > <ka...@hotmail.com>
> >>  > >>  > >>> Sent: Wednesday, September 28, 2016 8:42
> > PM
> >>  > >>  > >>> To: users@tomee.apache.org
> >>  > >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>  > >>>
> >>  > >>  > >>> Hmmm... I guess I'll have to @Produces
> > @Named the
> >>  > > conversation if I
> >>  > >>  > want to
> >>  > >>  > >>> use it in ELs. I don't know if
> > something like
> >>  > >>  > >>> #{applicationScope['javax.
> > enterprise.context.
> >>  > >>  > conversation'].transient}
> >>  > >>  > >>> would work?
> >>  > >>  > >>>
> >>  > >>  > >>> I remember back in my JSP days that,
> > sometimes, I had to
> >>  > > use
> >>  > >>  something
> >>  > >>  > like
> >>  > >>  > >>> ${requestScope['javax.servlet.
> >>  > > forward.request_uri']} instead of
> >>  > >>  > >>> plain ${javax.servlet.forward.
> > request_uri}.
> >>  > >>  > >>>
> >>  > >>  > >>> Xavier
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> From: Romain Manni-Bucau
> > <rm...@gmail.com>
> >>  > >>  > >>> Sent: Wednesday, September 28, 2016 6:54
> > PM
> >>  > >>  > >>> To: users@tomee.apache.org
> >>  > >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>  > >>>
> >>  > >>  > >>> hmm, wonder if it is linked to the value
> > you try to
> >>  > > evaluate (which
> >>  > >>  > doesn't
> >>  > >>  > >>> respect EL spec even if in CDI spec -
> > don't ask
> >>  > > please ;)).. See
> >>  > >>  > >>> https://issues.jboss.org/
> > browse/CDITCK-462 /
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > System Dashboard - JBoss Issue Tracker
> >>  > >>  > issues.jboss.org
> >>  > >>  > Atlassian JIRA Project Management Software
> >>  > > (v6.4.11#64026-sha1:78f6ec4)
> >>  > >>  > About JIRA; Report a problem; Powered by a free
> > Atlassian JIRA open
> >>  > >>  source
> >>  > >>  > license for Red Hat ...
> >>  > >>  > >>> http://lists.jboss.org/
> > pipermail/cdi-dev/2015-
> >>  > > January/006009.html
> >>  > >>  >
> >>  > >>  >
> >>  > >>  > lists.jboss.org Mailing Lists
> >>  > >>  > lists.jboss.org
> >>  > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a
> > listing of all
> >>  > the
> >>  > >>  > public mailing lists on lists.jboss.org. Click on a
> > list name to
> >>  get
> >>  > >>  more
> >>  > >>  > information ...
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> Romain Manni-Bucau
> >>  > >>  > >>> @rmannibucau <https://twitter.com/
> > rmannibucau> |
> >>  > > Blog
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>>
> >>  > >>  > >>> Romain Manni-Bucau (@rmannibucau) |
> > Twitter
> >>  > >>  > >>> twitter.com
> >>  > >>  > >>> The latest Tweets from Romain Manni-Bucau
> > (@rmannibucau).
> >>  > > ASF /
> >>  > >>  > Java(EE) /
> >>  > >>  > >>> Angular. LinkedIn:
> > https://t.co/dX7XMGjbBi. JavaEE
> >>  > > Factory:
> >>  > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> >>  > >>  > >>> <https://blog-rmannibucau.
> > rhcloud.com> | Old
> >>  > > Wordpress Blog
> >>  > >>  > >>> <http://rmannibucau.wordpress. com>
> > | Github
> >>  > >>  > >>> <https://github.com/ rmannibucau> |
> >>  > >>  > >>> LinkedIn <https://www.linkedin.com/in/
> > rmannibucau>
> >>  > > | Tomitriber
> >>  > >>  > >>> <http://www.tomitribe.com> | JavaEE
> > Factory
> >>  > >>  > >>> <https://javaeefactory-
> > rmannibucau.rhcloud.com>
> >>  > >>  > >>>
> >>  > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> >>  > > <ka...@hotmail.com>:
> >>  > >>  > >>>
> >>  > >>  > >>>>  Hi Romain,
> >>  > >>  > >>>>
> >>  > >>  > >>>>  I tried with
> > org.apache.tomcat:tomcat-
> >>  > > jasper-el:8.5.5 but it does
> >>  > >>  > not
> >>  > >>  > >>>>  parse my expression until I change
> >>  > > ".transient" by
> >>  > >>  > >>> ".isTransient()" and
> >>  > >>  > >>>>  then it gives the same error:
> > javax.el.
> >>  > > PropertyNotFoundException:
> >>  > >>  > >>>>  ELResolver cannot handle a null base
> > Object with
> >>  > > identifier
> >>  > >>  > >>> 'javax'.
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Does the EL context need something
> > else than adding
> >>  > > the
> >>  > >>  > >>>>  BeanManager.getELResolver()  to be
> > able to resolve
> >>  > > some implicit
> >>  > >>  > objects? I
> >>  > >>  > >>>>  don't understand why it works
> > with ri-1.0.
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>
> >>  > >>  > >>>>  From: Romain Manni-Bucau
> >>  > > <rm...@gmail.com>
> >>  > >>  > >>>>  Sent: Wednesday, September 28, 2016
> > 4:02 PM
> >>  > >>  > >>>>  To: users@tomee.apache.org
> >>  > >>  > >>>>  Subject: Re: OpenEJB and EL
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Hi Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>  On the phone so hard to give you a
> > link bit try
> >>  > > using tomcat el
> >>  > >>  impl
> >>  > >>  > of
> >>  > >>  > >>>>  tomcat 8.5
> >>  > >>  > >>>>
> >>  > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier
> > Dury"
> >>  > > <ka...@hotmail.com>
> >>  > >>  > >>> a écrit :
> >>  > >>  > >>>>
> >>  > >>  > >>>>  > Hi,
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > I am using OpenEJB for my tests
> > and need
> >>  > > support for EL
> >>  > >>  > expressions in
> >>  > >>  > >>> my
> >>  > >>  > >>>>  > own code.
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > By default, if I do something
> > like this (pay
> >>  > > attention to the
> >>  > >>  > >>>>  expression):
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > ExpressionFactory factory =
> > beanManager.
> >>  > > wrapExpressionFactory(
> >>  > >>  > >>>>  > ExpressionFactory.newInstance(
> > ));
> >>  > >>  > >>>>  > StandardELContext elContext =
> > new
> >>  > > StandardELContext(factory);
> >>  > >>  > >>>>  > elContext.addELResolver(
> >>  > > beanManager.getELResolver());
> >>  > >>  > >>>>  > ValueExpression expression =
> >>  > > factory.createValueExpression(
> >>  > >>  > elContext,
> >>  > >>  > >>>>  >
> > "#{javax.enterprise.context.
> >>  > > conversation.transient}",
> >>  > >>  > >>> Boolean.class);
> >>  > >>  > >>>>  > expression.getValue(elContext) ;
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > and only add
> > org.apache.tomee:openejb-core:
> >>  > > 7.0.1 to my project
> >>  > >>  > then I
> >>  > >>  > >>>>  get
> >>  > >>  > >>>>  > javax.el.ELException: Unable to
> > find
> >>  > > ExpressionFactory of type:
> >>  > >>  > >>>>  > org.apache.el.
> > ExpressionFactoryImpl
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > if I add
> > org.glassfish:javax.el:3.0.0 then I
> >>  > > get javax.el.
> >>  > >>  > >>>>  PropertyNotFoundException:
> >>  > >>  > >>>>  > ELResolver cannot handle a null
> > base Object
> >>  > > with identifier
> >>  > >>  > >>> 'javax'
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > if I switch the EL library to
> >>  > > com.sun.el:el-ri:1.0 (+
> >>  > >>  > >>> META-INF/javax.el.
> >>  > >>  > >>>>  ExpressionFactory
> >>  > >>  > >>>>  > < com.sun.el.
> > ExpressionFactoryImpl) then my
> >>  > > expression can be
> >>  > >>  > >>> evaluated
> >>  > >>  > >>>>  > but I can't use any new
> > feature of 3.0
> >>  > > (like lambdas)
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > So, either my dependencies are
> > wrong or I am
> >>  > > not correctly
> >>  > >>  > >>> initializing
> >>  > >>  > >>>>  my
> >>  > >>  > >>>>  > factory.
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Does anybody have an idea?
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Thanks,
> >>  > >>  > >>>>  >
> >>  > >>  > >>>>  > Xavier
> >>  > >>  > >>>>
> >>  > >>  > >>>>
> >>  > >>  > >>>
> >>  > >>  > >>
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  > >
> >>  > >>  >
> >>  > >>  >
> >>  > >>
> >>  > >>
> >>  > >
> >>  >
> >>  >
> >>
> >>
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Thanks, now I understand better why it is not implemented in OWB.

Funny, I came to the same conclusion and was busy implementing an @ApplicationScoped @Named Beans (which implements Map<String, Object> so I can do #{beans['javax.enteprise.context.conversation']}.

Xavier






From: Mark Struberg <st...@yahoo.de.INVALID>
Sent: Thursday, September 29, 2016 10:32 AM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Yea, now you probably understand my 'oh boy' reaction ;)


My initial reaction when discovering this problem back then (a few years ago) was to simply replace the dots with underlines -> javax_enterprise_context_conversation

But this solution wasn't choosen. 


The reason why I don't like to implement it in OWB is that CDI is sadly _not_ the only spec which defined such. E.g. the Servlet specifies that there is a request parameter 'javax.servlet.request.key_size' or 'javax.servlet.error.message' and others.

But despite all servlet request parameters are available via an ELResolver it is also _not_ possible to simply write "#{javax.servlet.request.key_size}".

While in the servlet spec this was primarily targetted to be programmatically available from the request attriubute (and EL is only an implicit way), it is a 'first class citizen' in CDI. But still doesn't work.

You could provide the following which is probably even more straight forward than the producer:


@ApplicationScoped
@Named
public class NameResolver {

  private @Inject BeanManager bm;


  public Object get(String beanName) {
    Set<Bean> beans = bm.getBeans(beanName);
    Bean bean = bm.resolve(beans);
    return bm.getReference(bean, bean.getType() or so, bm.createCreationalContext());

  }
}


(of course with null checks etc, just sketched that wo trying).
That should be available as #{nameResolver.get("javax.enterprise.context.conversation")}


LieGrue,
strub

> On Thursday, 29 September 2016, 9:21, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > 2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>>  Indeed, @Named != named... got it! :-)
>> 
>>  But I still fail to understand _where_ the workaround for 
> 'javax...' is
>>  actually implemented:
>> 
>> 
> nowhere cause it introduces other issues in EL so the workaround is only a
> workaround not a nasty way to get a feature.
> 
> 
>>  1) if it is implemented in OWB then why is 
> 'elContext.addELResolver(beanManager.getELResolver());'
>>  not working? I would expect the returned el resolver to contain the
>>  workaround.
>>  2) if it is implemented elsewhere (TomEE for example), I don't 
> understand
>>  why as this requirement comes from the CDI spec and should be implemented
>>  in OWB... so back to (1)
>> 
>>  I am stuck in an infinite loop ;-)
>> 
>> 
>> 
>> 
>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  Sent: Thursday, September 29, 2016 8:54 AM
>>  To: users@tomee.apache.org
>>  Subject: Re: OpenEJB and EL
>> 
>>  2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>> 
>>  > @Mark
>>  >
>>  > thanks, it works when adding any other qualifier!
>>  >
>>  > btw, do you think it would hurt to qualify the built-in conversation 
> bean
>>  > with @Named("javax.enterprise.context.conversation") in OWB? 
> That way I
>>  > could inject the built-in with @Inject @Named("javax.enteprise.
>>  context.conversation")
>>  > and expose it via @Produces @Named("conversation") without 
> resorting to
>>  > some extra qualifier.
>>  >
>>  > @Romain
>>  >
>>  > I was wondering where exactly is your hacky el resolver implemented? 
> If
>>  > the "javax.enterprise.context.conversation" name is a 
> requirement coming
>>  > from the CDI spec, then I would suppose it is implemented in OWB (in 
> the
>>  > resolver you get from the BeanManager) but as my tests with OEJB+OWB
>>  fail,
>>  > I suppose it is not there (or not enabled in some way). On the 
> contrary,
>>  if
>>  > the requirement comes from the java EE spec, then I suppose it is
>>  > implemented in TomEE and that would explain why my tests fail.
>>  >
>>  >
>>  The name is built it in openwebbeans:
>>  https://github.com/apache/openwebbeans/blob/trunk/
>>  webbeans-impl/src/main/java/org/apache/webbeans/component/
>>  ConversationBean.java#L54
>> 
>>  The spec states:
>> 
>>  "The container provides a built-in bean with bean type Conversation, 
> scope
>>  @RequestScoped, and qualifier@Default, named
>>  javax.enterprise.context.conversation."
>> 
>>  So no qualifier @Named but a Bean<?> name (no comment ;))
>> 
>> 
>>  > Xavier
>>  >
>>  >
>>  >
>>  >
>>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > Sent: Thursday, September 29, 2016 12:12 AM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > @Default is always assumed when you don't add a specific Qualifier 
> other
>>  > than @Named and @Any.
>>  >
>>  > Xavier, can you please add any random qualifier? E.g. @Destroyed.
>>  >
>>  > This will stop CDI from complaining but EL should work.
>>  >
>>  > LieGrue,
>>  > strub
>>  >
>>  >
>>  >
>>  >
>>  >
>>  > > On Thursday, 29 September 2016, 0:04, Xavier Dury 
> <ka...@hotmail.com>
>>  > wrote:
>>  > > > 
> https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf



OpenEjbElTest.java
gist.github.com
property=
>> 
>> 
>> 
>>  OpenEjbElTest.java
>>  gist.github.com
>>  property=
>>  >
>>  >
>>  >
>>  > OpenEjbElTest.java
>>  > gist.github.com
>>  > property=
>>  > >
>>  > >
>>  > >
>>  > > From: Xavier Dury <ka...@hotmail.com>
>>  > > Sent: Wednesday, September 28, 2016 11:54 PM
>>  > > To: users@tomee.apache.org
>>  > > Subject: Re: OpenEJB and EL
>>  > >
>>  > > No, I didn't add the @Default to the @Produces method.
>>  > >
>>  > > I verified:
>>  > >
>>  > > @RequestScoped
>>  > > public class ConversationWrapper {
>>  > >
>>  > >         private @Inject Conversation conv;
>>  > >
>>  > >         @Produces
>>  > >         @Dependent
>>  > >         @Named("conv")
>>  > >         public Conversation getConv() {
>>  > >                 return conv;
>>  > >         }
>>  > > }
>>  > >
>>  > > result:
>>  > >
>>  > > Caused by: javax.enterprise.inject.AmbiguousResolutionException: 
> There
>>  > is more
>>  > > than one Bean with type javax.enterprise.context.
>>  ConversationQualifiers:
>>  > > [@javax.enterprise.inject.Default()]
>>  > > for injection into Field Injection Point, field name :  conv, 
> Bean
>>  Owner
>>  > :
>>  > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  > > Types:[java.lang.Object,eg.ConversationWrapper],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > > found beans:
>>  > > ConversationImpl, WebBeansType:CONVERSATION,
>>  > > Name:javax.enterprise.context.conversation, API
>>  > > Types:[java.lang.Object,org.apache.webbeans.conversation.
>>  > ConversationImpl,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]
>>  > from
>>  > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any,javax.inject.Named]
>>  > > from
>>  > > 
> file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
>>  > ConversationWrapper.class
>>  > >
>>  > >
>>  > >
>>  > >
>>  > > From: Romain Manni-Bucau <rm...@gmail.com>
>>  > > Sent: Wednesday, September 28, 2016 11:47 PM
>>  > > To: users@tomee.apache.org
>>  > > Subject: Re: OpenEJB and EL
>>  > >
>>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > > enterprise.inject.Any,javax.inject.Named] from 
> file:/D:/development/
>>  > > 
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  > >
>>  > > Why is there @Default there? producer should only have the @Named 
> you
>>  set
>>  > >
>>  > >
>>  > > Romain Manni-Bucau
>>  > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog


Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>>  >
>>  >
>>  >
>>  > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > twitter.com
>>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / 
> Java(EE)
>>  /
>>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > https://t.co/0VnvWwbedt . Blog ...
>>  > >
>>  > >
>>  > >
>>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > > twitter.com
>>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
>>  Java(EE)
>>  > /
>>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > > https://t.co/0VnvWwbedt . Blog ...
>>  > >
>>  > >
>>  > >
>>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > > twitter.com
>>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
>>  Java(EE)
>>  > /
>>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > > https://t.co/0VnvWwbedt . Blog ...
>>  > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>>  > >
>>  > >
>>  > > RBlog: the RManniBucau v2 Blog
>>  > > blog-rmannibucau.rhcloud.com
>>  > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, 
> Angular, Open
>>  > Source,
>>  > > Code and geeky topics...
>>  > > <http://rmannibucau.wordpress.com> | Github
>>  > > <https://github.com/rmannibucau> |
>>  > >
>>  > >
>>  > > [old blog] new RManniBucau().blog()
>>  > > rmannibucau.wordpress.com
>>  > > New blog on: https://blog-rmannibucau.rhcloud.com/
>>  > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> Tomitriber
>>  > > <http://www.tomitribe.com> | JavaEE Factory
>>  > > <https://javaeefactory-rmannibucau.rhcloud.com>
>>  > >
>>  > > 2016-09-28 23:45 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >
>>  > >>  It seems that to inject the conversation in
>>  > > ConversationWrapper.conversation,
>>  > >>  OWB does consider both the build-in conversation bean and 
> the
>>  produced
>>  > one
>>  > >>  from... ConversationWrapper.getConv().
>>  > >>
>>  > >>  I tried something like that:
>>  > >>
>>  > >>  @RequestScoped
>>  > >>  public class ConversationWrapper {
>>  > >>
>>  > >>          private @Inject
>>  > > @Named("javax.enterprise.context.conversation")
>>  > >>  Conversation conv;
>>  > >>
>>  > >>          @Produces
>>  > >>          @Dependent
>>  > >>          @Named("conv")
>>  > >>          public Conversation getConv() {
>>  > >>                  return conv;
>>  > >>          }
>>  > >>  }
>>  > >>
>>  > >>  But it gives the following error:
>>  > >>
>>  > >>  Caused by: 
> javax.enterprise.inject.UnsatisfiedResolutionException:
>>  Api
>>  > >>  type [javax.enterprise.context.Conversation] is not found 
> with the
>>  > >>  qualifiers
>>  > >>  Qualifiers: 
> [@javax.inject.Named(value=javax.enterprise.context.
>>  > >>  conversation)]
>>  > >>  for injection into Field Injection Point, field name :  
> conv, Bean
>>  > Owner :
>>  > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  > >>  Types:[eg.ConversationWrapper,java.lang.Object],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>  From: Xavier Dury <ka...@hotmail.com>
>>  > >>  Sent: Wednesday, September 28, 2016 11:34 PM
>>  > >>  To: users@tomee.apache.org
>>  > >>  Subject: Re: OpenEJB and EL
>>  > >>
>>  > >>  Got the same result with 'conv':
>>  > >>
>>  > >>  Caused by: 
> javax.enterprise.inject.AmbiguousResolutionException:
>>  > There is
>>  > >>  more than one Bean with type
>>  > > javax.enterprise.context.ConversationQualifiers:
>>  > >>  [@javax.enterprise.inject.Default()]
>>  > >>  for injection into Field Injection Point, field name :  
> conversation,
>>  > Bean
>>  > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED, 
> Name:null, API
>>  > >>  Types:[java.lang.Object,eg.ConversationAliaser],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > >>  found beans:
>>  > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > >>  
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  enterprise.inject.Any,javax.inject.Named] from 
> file:/D:/development/
>>  > >>  workspaces/openejb-el/target/test-classes/eg/
>>  ConversationWrapper.class
>>  > >>  ConversationImpl, WebBeansType:CONVERSATION,
>>  > > Name:javax.enterprise.context.conversation,
>>  > >>  API 
> Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > >>  javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]
>>  > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > >>  
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  > >>  Sent: Wednesday, September 28, 2016 11:29 PM
>>  > >>  To: users@tomee.apache.org
>>  > >>  Cc: Mark Struberg
>>  > >>  Subject: Re: OpenEJB and EL
>>  > >>
>>  > >>  missing @Named("conv")?
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau
>>  > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>  > >>
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>  twitter.com
>>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > >>  https://t.co/0VnvWwbedt . Blog ...
>>  > >>
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>  twitter.com
>>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > >>  https://t.co/0VnvWwbedt . Blog ...
>>  > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress
> Blog
>>  > >>
>>  > >>
>>  > >>  RBlog: the RManniBucau v2 Blog
>>  > >>  blog-rmannibucau.rhcloud.com
>>  > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, 
> Angular,
>>  Open
>>  > >>  Source, Code and geeky topics...
>>  > >>  <http://rmannibucau.wordpress.com> | Github
> <https://github.com/
>>  > >>  rmannibucau> |
>>  > >>
>>  > >>
>>  > >>  [old blog] new RManniBucau().blog()
>>  > >>  rmannibucau.wordpress.com
>>  > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
>>  > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> Tomitriber
>>  > >>  <http://www.tomitribe.com> | JavaEE Factory
>>  > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
>>  > >>
>>  > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >>
>>  > >>  >
>>  > >>  > Caused by: 
> javax.enterprise.inject.AmbiguousResolutionException:
>>  > There
>>  > >>  is
>>  > >>  > more than one Bean with type javax.enterprise.context.
>>  > >>  ConversationQualifiers:
>>  > >>  > [@javax.enterprise.inject.Default()]
>>  > >>  > for injection into Field Injection Point, field name :
>>  conversation,
>>  > >>  Bean
>>  > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, 
> Name:null, API
>>  > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
>>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  enterprise.inject.Any]]
>>  > >>  > found beans:
>>  > >>  > Conversation, WebBeansType:PRODUCERMETHOD, 
> Name:conversation, API
>>  > >>  > 
> Types:[javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  > enterprise.inject.Any,javax.inject.Named] from
>>  file:/D:/development/
>>  > >>  > workspaces/openejb-el/target/test-classes/eg/
>>  > ConversationWrapper.class
>>  > >>  > ConversationImpl, WebBeansType:CONVERSATION,
>>  > >>  Name:javax.enterprise.context.conversation,
>>  > >>  > API 
> Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > >>  > 
> javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  >
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]
>>  > >>  > from 
> jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > >>  > 
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
>>  > >>  > To: users@tomee.apache.org
>>  > >>  > Subject: Re: OpenEJB and EL
>>  > >>  >
>>  > >>  > +1
>>  > >>  >
>>  > >>  > means
>>  > >>  >
>>  > >>  > @RequestScoped
>>  > >>  >
>>  > >>  > public class ConversationWrapper {
>>  > >>  >   private @Inject Conversation conv;
>>  > >>  >
>>  > >>  >   @Produces
>>  > >>  >   @Dependent
>>  > >>  >   @Named("conv")
>>  > >>  >
>>  > >>  >   public Conversation getConv() {
>>  > >>  >     return conv;
>>  > >>  >   }
>>  > >>  > }
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  > On Wednesday, 28 September 2016, 23:10, Romain 
> Manni-Bucau <
>>  > >>  > rmannibucau@gmail.com> wrote:
>>  > >>  >
>>  > >>  >
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >a producer allows to get a shorter/more elegant 
> naming like
>>  > > #{conv.id}
>>  > >>  > if you @Produces @Named("conv") ;)
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >Romain Manni-Bucau
>>  > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github 
> | LinkedIn |
>>  > >>  > Tomitriber | JavaEE Factory
>>  > >>  > >
>>  > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
>>  > > <st...@yahoo.de.invalid>:
>>  > >>  > >
>>  > >>  > >Oh boy, sorry for you. You did hit a blank spot in 
> the CDI spec.
>>  > >>  > >>
>>  > >>  > >>Problem is that the EE umbrella spec, the EL 
> spec and the CDI
>>  > > spec
>>  > >>  > contradict each other.
>>  > >>  > >>
>>  > >>  > >>The Weld guys solved this by introducing a 
> Javax class. But
>>  > > that takes
>>  > >>  > away the whole javax.* tree for the EL. That's just 
> not good as it
>>  > >>  > contradicts the EL spec.
>>  > >>  > >>
>>  > >>  > >>Could you please try the following
>>  > >>  > >>
>>  > >>  > >>@RequestScoped
>>  > >>  > >>@Named("conversation")
>>  > >>  > >>public class ConversationWrapper {
>>  > >>  > >>   private @Inject Conversation conv;
>>  > >>  > >>
>>  > >>  > >>  public Conversation get() {
>>  > >>  > >>       return conv;
>>  > >>  > >>   }
>>  > >>  > >>}
>>  > >>  > >>
>>  > >>  > >>And in the EL just use 
> #{conversation.get.id}
>>  > >>  > >>
>>  > >>  > >>LieGrue,
>>  > >>  > >>strub
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>> On Wednesday, 28 September 2016, 22:12, 
> Xavier Dury <
>>  > >>  > kalgon@hotmail.com> wrote:
>>  > >>  > >>> > I really don't understand how 
> something like
>>  > > <f:param
>>  > >>  > >>> name="cid"
>>  > >>  > >>> value="#{javax.enterprise.
>>  > > context.conversation.id}"/> actually
>>  > >>  > >>> works... something must be made to make 
> the EL processor
>>  > > accept that
>>  > >>  > invalid
>>  > >>  > >>> bean name.
>>  > >>  > >>>
>>  > >>  > >>> Making a producer which @Produces @Named 
> Conversation
>>  > > conflicts with
>>  > >>  > the
>>  > >>  > >>> built-in bean from OWB (with 
> WebBeanType.CONVERSATION)...
>>  > >>  > >>>
>>  > >>  > >>> ... so, I have done the following for my 
> tests but I feel
>>  > > a bit
>>  > >>  > ashamed because
>>  > >>  > >>> I can't imagine there is no better 
> solution than this
>>  > > ;-)
>>  > >>  > >>>
>>  > >>  > >>> public class ConversationAliaser {
>>  > >>  > >>>     public class Javax {
>>  > >>  > >>>         public Enterprise getEnterprise() 
> {return
>>  > > new Enterprise();}
>>  > >>  > >>>
>>  > >>  > >>>     }
>>  > >>  > >>>     public class Enterprise {
>>  > >>  > >>>         public Context getContext() 
> {return new
>>  > > Context();}
>>  > >>  > >>>     }
>>  > >>  > >>>     public class Context {
>>  > >>  > >>>         public Conversation 
> getConversation()
>>  > > {return conversation;}
>>  > >>  > >>>
>>  > >>  > >>>     }
>>  > >>  > >>>     @Inject
>>  > >>  > >>>     private Conversation conversation;
>>  > >>  > >>>     @Produces @ApplicationScoped
>>  > > @Named("javax")
>>  > >>  > >>>     public Javax javax() {return new 
> Javax();}
>>  > >>  > >>> }
>>  > >>  > >>>
>>  > >>  > >>> But that works!
>>  > >>  > >>>
>>  > >>  > >>> Xavier
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> From: Xavier Dury 
> <ka...@hotmail.com>
>>  > >>  > >>> Sent: Wednesday, September 28, 2016 8:42 
> PM
>>  > >>  > >>> To: users@tomee.apache.org
>>  > >>  > >>> Subject: Re: OpenEJB and EL
>>  > >>  > >>>
>>  > >>  > >>> Hmmm... I guess I'll have to @Produces 
> @Named the
>>  > > conversation if I
>>  > >>  > want to
>>  > >>  > >>> use it in ELs. I don't know if 
> something like
>>  > >>  > >>> #{applicationScope['javax. 
> enterprise.context.
>>  > >>  > conversation'].transient}
>>  > >>  > >>> would work?
>>  > >>  > >>>
>>  > >>  > >>> I remember back in my JSP days that, 
> sometimes, I had to
>>  > > use
>>  > >>  something
>>  > >>  > like
>>  > >>  > >>> ${requestScope['javax.servlet.
>>  > > forward.request_uri']} instead of
>>  > >>  > >>> plain ${javax.servlet.forward. 
> request_uri}.
>>  > >>  > >>>
>>  > >>  > >>> Xavier
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> From: Romain Manni-Bucau 
> <rm...@gmail.com>
>>  > >>  > >>> Sent: Wednesday, September 28, 2016 6:54 
> PM
>>  > >>  > >>> To: users@tomee.apache.org
>>  > >>  > >>> Subject: Re: OpenEJB and EL
>>  > >>  > >>>
>>  > >>  > >>> hmm, wonder if it is linked to the value 
> you try to
>>  > > evaluate (which
>>  > >>  > doesn't
>>  > >>  > >>> respect EL spec even if in CDI spec - 
> don't ask
>>  > > please ;)).. See
>>  > >>  > >>> https://issues.jboss.org/
> browse/CDITCK-462 /
>>  > >>  >
>>  > >>  >
>>  > >>  > System Dashboard - JBoss Issue Tracker
>>  > >>  > issues.jboss.org
>>  > >>  > Atlassian JIRA Project Management Software
>>  > > (v6.4.11#64026-sha1:78f6ec4)
>>  > >>  > About JIRA; Report a problem; Powered by a free 
> Atlassian JIRA open
>>  > >>  source
>>  > >>  > license for Red Hat ...
>>  > >>  > >>> http://lists.jboss.org/ 
> pipermail/cdi-dev/2015-
>>  > > January/006009.html
>>  > >>  >
>>  > >>  >
>>  > >>  > lists.jboss.org Mailing Lists
>>  > >>  > lists.jboss.org
>>  > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a 
> listing of all
>>  > the
>>  > >>  > public mailing lists on lists.jboss.org. Click on a 
> list name to
>>  get
>>  > >>  more
>>  > >>  > information ...
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> Romain Manni-Bucau
>>  > >>  > >>> @rmannibucau <https://twitter.com/ 
> rmannibucau> |
>>  > > Blog
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> Romain Manni-Bucau (@rmannibucau) | 
> Twitter
>>  > >>  > >>> twitter.com
>>  > >>  > >>> The latest Tweets from Romain Manni-Bucau 
> (@rmannibucau).
>>  > > ASF /
>>  > >>  > Java(EE) /
>>  > >>  > >>> Angular. LinkedIn: 
> https://t.co/dX7XMGjbBi. JavaEE
>>  > > Factory:
>>  > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
>>  > >>  > >>> <https://blog-rmannibucau. 
> rhcloud.com> | Old
>>  > > Wordpress Blog
>>  > >>  > >>> <http://rmannibucau.wordpress. com> 
> | Github
>>  > >>  > >>> <https://github.com/ rmannibucau> |
>>  > >>  > >>> LinkedIn <https://www.linkedin.com/in/ 
> rmannibucau>
>>  > > | Tomitriber
>>  > >>  > >>> <http://www.tomitribe.com> | JavaEE
> Factory
>>  > >>  > >>> <https://javaeefactory- 
> rmannibucau.rhcloud.com>
>>  > >>  > >>>
>>  > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
>>  > > <ka...@hotmail.com>:
>>  > >>  > >>>
>>  > >>  > >>>>  Hi Romain,
>>  > >>  > >>>>
>>  > >>  > >>>>  I tried with 
> org.apache.tomcat:tomcat-
>>  > > jasper-el:8.5.5 but it does
>>  > >>  > not
>>  > >>  > >>>>  parse my expression until I change
>>  > > ".transient" by
>>  > >>  > >>> ".isTransient()" and
>>  > >>  > >>>>  then it gives the same error: 
> javax.el.
>>  > > PropertyNotFoundException:
>>  > >>  > >>>>  ELResolver cannot handle a null base 
> Object with
>>  > > identifier
>>  > >>  > >>> 'javax'.
>>  > >>  > >>>>
>>  > >>  > >>>>  Does the EL context need something 
> else than adding
>>  > > the
>>  > >>  > >>>>  BeanManager.getELResolver()  to be 
> able to resolve
>>  > > some implicit
>>  > >>  > objects? I
>>  > >>  > >>>>  don't understand why it works 
> with ri-1.0.
>>  > >>  > >>>>
>>  > >>  > >>>>  Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>
>>  > >>  > >>>>  From: Romain Manni-Bucau
>>  > > <rm...@gmail.com>
>>  > >>  > >>>>  Sent: Wednesday, September 28, 2016 
> 4:02 PM
>>  > >>  > >>>>  To: users@tomee.apache.org
>>  > >>  > >>>>  Subject: Re: OpenEJB and EL
>>  > >>  > >>>>
>>  > >>  > >>>>  Hi Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>  On the phone so hard to give you a 
> link bit try
>>  > > using tomcat el
>>  > >>  impl
>>  > >>  > of
>>  > >>  > >>>>  tomcat 8.5
>>  > >>  > >>>>
>>  > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier 
> Dury"
>>  > > <ka...@hotmail.com>
>>  > >>  > >>> a écrit :
>>  > >>  > >>>>
>>  > >>  > >>>>  > Hi,
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > I am using OpenEJB for my tests 
> and need
>>  > > support for EL
>>  > >>  > expressions in
>>  > >>  > >>> my
>>  > >>  > >>>>  > own code.
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > By default, if I do something 
> like this (pay
>>  > > attention to the
>>  > >>  > >>>>  expression):
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > ExpressionFactory factory = 
> beanManager.
>>  > > wrapExpressionFactory(
>>  > >>  > >>>>  > ExpressionFactory.newInstance( 
> ));
>>  > >>  > >>>>  > StandardELContext elContext = 
> new
>>  > > StandardELContext(factory);
>>  > >>  > >>>>  > elContext.addELResolver(
>>  > > beanManager.getELResolver());
>>  > >>  > >>>>  > ValueExpression expression =
>>  > > factory.createValueExpression(
>>  > >>  > elContext,
>>  > >>  > >>>>  > 
> "#{javax.enterprise.context.
>>  > > conversation.transient}",
>>  > >>  > >>> Boolean.class);
>>  > >>  > >>>>  > expression.getValue(elContext) ;
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > and only add 
> org.apache.tomee:openejb-core:
>>  > > 7.0.1 to my project
>>  > >>  > then I
>>  > >>  > >>>>  get
>>  > >>  > >>>>  > javax.el.ELException: Unable to 
> find
>>  > > ExpressionFactory of type:
>>  > >>  > >>>>  > org.apache.el. 
> ExpressionFactoryImpl
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > if I add 
> org.glassfish:javax.el:3.0.0 then I
>>  > > get javax.el.
>>  > >>  > >>>>  PropertyNotFoundException:
>>  > >>  > >>>>  > ELResolver cannot handle a null 
> base Object
>>  > > with identifier
>>  > >>  > >>> 'javax'
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > if I switch the EL library to
>>  > > com.sun.el:el-ri:1.0 (+
>>  > >>  > >>> META-INF/javax.el.
>>  > >>  > >>>>  ExpressionFactory
>>  > >>  > >>>>  > < com.sun.el. 
> ExpressionFactoryImpl) then my
>>  > > expression can be
>>  > >>  > >>> evaluated
>>  > >>  > >>>>  > but I can't use any new 
> feature of 3.0
>>  > > (like lambdas)
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > So, either my dependencies are 
> wrong or I am
>>  > > not correctly
>>  > >>  > >>> initializing
>>  > >>  > >>>>  my
>>  > >>  > >>>>  > factory.
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Does anybody have an idea?
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Thanks,
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>
>>  > >>  > >>>
>>  > >>  > >>
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >
>>  > >>  >
>>  > >>  >
>>  > >>
>>  > >>
>>  > >
>>  >
>>  >
>> 
>> 
> 
    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Yea, now you probably understand my 'oh boy' reaction ;)


My initial reaction when discovering this problem back then (a few years ago) was to simply replace the dots with underlines -> javax_enterprise_context_conversation

But this solution wasn't choosen. 


The reason why I don't like to implement it in OWB is that CDI is sadly _not_ the only spec which defined such. E.g. the Servlet specifies that there is a request parameter 'javax.servlet.request.key_size' or 'javax.servlet.error.message' and others. 

But despite all servlet request parameters are available via an ELResolver it is also _not_ possible to simply write "#{javax.servlet.request.key_size}".

While in the servlet spec this was primarily targetted to be programmatically available from the request attriubute (and EL is only an implicit way), it is a 'first class citizen' in CDI. But still doesn't work.

You could provide the following which is probably even more straight forward than the producer:


@ApplicationScoped
@Named
public class NameResolver {

  private @Inject BeanManager bm;


  public Object get(String beanName) {
    Set<Bean> beans = bm.getBeans(beanName);
    Bean bean = bm.resolve(beans);
    return bm.getReference(bean, bean.getType() or so, bm.createCreationalContext());

  }
}


(of course with null checks etc, just sketched that wo trying).
That should be available as #{nameResolver.get("javax.enterprise.context.conversation")}


LieGrue,
strub

> On Thursday, 29 September 2016, 9:21, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > 2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>>  Indeed, @Named != named... got it! :-)
>> 
>>  But I still fail to understand _where_ the workaround for 
> 'javax...' is
>>  actually implemented:
>> 
>> 
> nowhere cause it introduces other issues in EL so the workaround is only a
> workaround not a nasty way to get a feature.
> 
> 
>>  1) if it is implemented in OWB then why is 
> 'elContext.addELResolver(beanManager.getELResolver());'
>>  not working? I would expect the returned el resolver to contain the
>>  workaround.
>>  2) if it is implemented elsewhere (TomEE for example), I don't 
> understand
>>  why as this requirement comes from the CDI spec and should be implemented
>>  in OWB... so back to (1)
>> 
>>  I am stuck in an infinite loop ;-)
>> 
>> 
>> 
>> 
>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  Sent: Thursday, September 29, 2016 8:54 AM
>>  To: users@tomee.apache.org
>>  Subject: Re: OpenEJB and EL
>> 
>>  2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>> 
>>  > @Mark
>>  >
>>  > thanks, it works when adding any other qualifier!
>>  >
>>  > btw, do you think it would hurt to qualify the built-in conversation 
> bean
>>  > with @Named("javax.enterprise.context.conversation") in OWB? 
> That way I
>>  > could inject the built-in with @Inject @Named("javax.enteprise.
>>  context.conversation")
>>  > and expose it via @Produces @Named("conversation") without 
> resorting to
>>  > some extra qualifier.
>>  >
>>  > @Romain
>>  >
>>  > I was wondering where exactly is your hacky el resolver implemented? 
> If
>>  > the "javax.enterprise.context.conversation" name is a 
> requirement coming
>>  > from the CDI spec, then I would suppose it is implemented in OWB (in 
> the
>>  > resolver you get from the BeanManager) but as my tests with OEJB+OWB
>>  fail,
>>  > I suppose it is not there (or not enabled in some way). On the 
> contrary,
>>  if
>>  > the requirement comes from the java EE spec, then I suppose it is
>>  > implemented in TomEE and that would explain why my tests fail.
>>  >
>>  >
>>  The name is built it in openwebbeans:
>>  https://github.com/apache/openwebbeans/blob/trunk/
>>  webbeans-impl/src/main/java/org/apache/webbeans/component/
>>  ConversationBean.java#L54
>> 
>>  The spec states:
>> 
>>  "The container provides a built-in bean with bean type Conversation, 
> scope
>>  @RequestScoped, and qualifier@Default, named
>>  javax.enterprise.context.conversation."
>> 
>>  So no qualifier @Named but a Bean<?> name (no comment ;))
>> 
>> 
>>  > Xavier
>>  >
>>  >
>>  >
>>  >
>>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > Sent: Thursday, September 29, 2016 12:12 AM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > @Default is always assumed when you don't add a specific Qualifier 
> other
>>  > than @Named and @Any.
>>  >
>>  > Xavier, can you please add any random qualifier? E.g. @Destroyed.
>>  >
>>  > This will stop CDI from complaining but EL should work.
>>  >
>>  > LieGrue,
>>  > strub
>>  >
>>  >
>>  >
>>  >
>>  >
>>  > > On Thursday, 29 September 2016, 0:04, Xavier Dury 
> <ka...@hotmail.com>
>>  > wrote:
>>  > > > 
> https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
>> 
>> 
>> 
>>  OpenEjbElTest.java
>>  gist.github.com
>>  property=
>>  >
>>  >
>>  >
>>  > OpenEjbElTest.java
>>  > gist.github.com
>>  > property=
>>  > >
>>  > >
>>  > >
>>  > > From: Xavier Dury <ka...@hotmail.com>
>>  > > Sent: Wednesday, September 28, 2016 11:54 PM
>>  > > To: users@tomee.apache.org
>>  > > Subject: Re: OpenEJB and EL
>>  > >
>>  > > No, I didn't add the @Default to the @Produces method.
>>  > >
>>  > > I verified:
>>  > >
>>  > > @RequestScoped
>>  > > public class ConversationWrapper {
>>  > >
>>  > >         private @Inject Conversation conv;
>>  > >
>>  > >         @Produces
>>  > >         @Dependent
>>  > >         @Named("conv")
>>  > >         public Conversation getConv() {
>>  > >                 return conv;
>>  > >         }
>>  > > }
>>  > >
>>  > > result:
>>  > >
>>  > > Caused by: javax.enterprise.inject.AmbiguousResolutionException: 
> There
>>  > is more
>>  > > than one Bean with type javax.enterprise.context.
>>  ConversationQualifiers:
>>  > > [@javax.enterprise.inject.Default()]
>>  > > for injection into Field Injection Point, field name :  conv, 
> Bean
>>  Owner
>>  > :
>>  > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  > > Types:[java.lang.Object,eg.ConversationWrapper],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > > found beans:
>>  > > ConversationImpl, WebBeansType:CONVERSATION,
>>  > > Name:javax.enterprise.context.conversation, API
>>  > > Types:[java.lang.Object,org.apache.webbeans.conversation.
>>  > ConversationImpl,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]
>>  > from
>>  > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any,javax.inject.Named]
>>  > > from
>>  > > 
> file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
>>  > ConversationWrapper.class
>>  > >
>>  > >
>>  > >
>>  > >
>>  > > From: Romain Manni-Bucau <rm...@gmail.com>
>>  > > Sent: Wednesday, September 28, 2016 11:47 PM
>>  > > To: users@tomee.apache.org
>>  > > Subject: Re: OpenEJB and EL
>>  > >
>>  > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > > enterprise.inject.Any,javax.inject.Named] from 
> file:/D:/development/
>>  > > 
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  > >
>>  > > Why is there @Default there? producer should only have the @Named 
> you
>>  set
>>  > >
>>  > >
>>  > > Romain Manni-Bucau
>>  > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>>  >
>>  >
>>  >
>>  > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > twitter.com
>>  > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / 
> Java(EE)
>>  /
>>  > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > https://t.co/0VnvWwbedt . Blog ...
>>  > >
>>  > >
>>  > >
>>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > > twitter.com
>>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
>>  Java(EE)
>>  > /
>>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > > https://t.co/0VnvWwbedt . Blog ...
>>  > >
>>  > >
>>  > >
>>  > > Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > > twitter.com
>>  > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
>>  Java(EE)
>>  > /
>>  > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > > https://t.co/0VnvWwbedt . Blog ...
>>  > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>>  > >
>>  > >
>>  > > RBlog: the RManniBucau v2 Blog
>>  > > blog-rmannibucau.rhcloud.com
>>  > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, 
> Angular, Open
>>  > Source,
>>  > > Code and geeky topics...
>>  > > <http://rmannibucau.wordpress.com> | Github
>>  > > <https://github.com/rmannibucau> |
>>  > >
>>  > >
>>  > > [old blog] new RManniBucau().blog()
>>  > > rmannibucau.wordpress.com
>>  > > New blog on: https://blog-rmannibucau.rhcloud.com/
>>  > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | 
> Tomitriber
>>  > > <http://www.tomitribe.com> | JavaEE Factory
>>  > > <https://javaeefactory-rmannibucau.rhcloud.com>
>>  > >
>>  > > 2016-09-28 23:45 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >
>>  > >>  It seems that to inject the conversation in
>>  > > ConversationWrapper.conversation,
>>  > >>  OWB does consider both the build-in conversation bean and 
> the
>>  produced
>>  > one
>>  > >>  from... ConversationWrapper.getConv().
>>  > >>
>>  > >>  I tried something like that:
>>  > >>
>>  > >>  @RequestScoped
>>  > >>  public class ConversationWrapper {
>>  > >>
>>  > >>          private @Inject
>>  > > @Named("javax.enterprise.context.conversation")
>>  > >>  Conversation conv;
>>  > >>
>>  > >>          @Produces
>>  > >>          @Dependent
>>  > >>          @Named("conv")
>>  > >>          public Conversation getConv() {
>>  > >>                  return conv;
>>  > >>          }
>>  > >>  }
>>  > >>
>>  > >>  But it gives the following error:
>>  > >>
>>  > >>  Caused by: 
> javax.enterprise.inject.UnsatisfiedResolutionException:
>>  Api
>>  > >>  type [javax.enterprise.context.Conversation] is not found 
> with the
>>  > >>  qualifiers
>>  > >>  Qualifiers: 
> [@javax.inject.Named(value=javax.enterprise.context.
>>  > >>  conversation)]
>>  > >>  for injection into Field Injection Point, field name :  
> conv, Bean
>>  > Owner :
>>  > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  > >>  Types:[eg.ConversationWrapper,java.lang.Object],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>  From: Xavier Dury <ka...@hotmail.com>
>>  > >>  Sent: Wednesday, September 28, 2016 11:34 PM
>>  > >>  To: users@tomee.apache.org
>>  > >>  Subject: Re: OpenEJB and EL
>>  > >>
>>  > >>  Got the same result with 'conv':
>>  > >>
>>  > >>  Caused by: 
> javax.enterprise.inject.AmbiguousResolutionException:
>>  > There is
>>  > >>  more than one Bean with type
>>  > > javax.enterprise.context.ConversationQualifiers:
>>  > >>  [@javax.enterprise.inject.Default()]
>>  > >>  for injection into Field Injection Point, field name :  
> conversation,
>>  > Bean
>>  > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED, 
> Name:null, API
>>  > >>  Types:[java.lang.Object,eg.ConversationAliaser],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]]
>>  > >>  found beans:
>>  > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  > >>  
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  enterprise.inject.Any,javax.inject.Named] from 
> file:/D:/development/
>>  > >>  workspaces/openejb-el/target/test-classes/eg/
>>  ConversationWrapper.class
>>  > >>  ConversationImpl, WebBeansType:CONVERSATION,
>>  > > Name:javax.enterprise.context.conversation,
>>  > >>  API 
> Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > >>  javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any]
>>  > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > >>  
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  > >>  Sent: Wednesday, September 28, 2016 11:29 PM
>>  > >>  To: users@tomee.apache.org
>>  > >>  Cc: Mark Struberg
>>  > >>  Subject: Re: OpenEJB and EL
>>  > >>
>>  > >>  missing @Named("conv")?
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau
>>  > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>  > >>
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>  twitter.com
>>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > >>  https://t.co/0VnvWwbedt . Blog ...
>>  > >>
>>  > >>
>>  > >>
>>  > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>  twitter.com
>>  > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  > >>  https://t.co/0VnvWwbedt . Blog ...
>>  > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress 
> Blog
>>  > >>
>>  > >>
>>  > >>  RBlog: the RManniBucau v2 Blog
>>  > >>  blog-rmannibucau.rhcloud.com
>>  > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, 
> Angular,
>>  Open
>>  > >>  Source, Code and geeky topics...
>>  > >>  <http://rmannibucau.wordpress.com> | Github 
> <https://github.com/
>>  > >>  rmannibucau> |
>>  > >>
>>  > >>
>>  > >>  [old blog] new RManniBucau().blog()
>>  > >>  rmannibucau.wordpress.com
>>  > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
>>  > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | 
> Tomitriber
>>  > >>  <http://www.tomitribe.com> | JavaEE Factory
>>  > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
>>  > >>
>>  > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >>
>>  > >>  >
>>  > >>  > Caused by: 
> javax.enterprise.inject.AmbiguousResolutionException:
>>  > There
>>  > >>  is
>>  > >>  > more than one Bean with type javax.enterprise.context.
>>  > >>  ConversationQualifiers:
>>  > >>  > [@javax.enterprise.inject.Default()]
>>  > >>  > for injection into Field Injection Point, field name :
>>  conversation,
>>  > >>  Bean
>>  > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, 
> Name:null, API
>>  > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
>>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  enterprise.inject.Any]]
>>  > >>  > found beans:
>>  > >>  > Conversation, WebBeansType:PRODUCERMETHOD, 
> Name:conversation, API
>>  > >>  > 
> Types:[javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > >>  > enterprise.inject.Any,javax.inject.Named] from
>>  file:/D:/development/
>>  > >>  > workspaces/openejb-el/target/test-classes/eg/
>>  > ConversationWrapper.class
>>  > >>  > ConversationImpl, WebBeansType:CONVERSATION,
>>  > >>  Name:javax.enterprise.context.conversation,
>>  > >>  > API 
> Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > >>  > 
> javax.enterprise.context.Conversation,java.lang.Object],
>>  > >>  >
>>  > > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]
>>  > >>  > from 
> jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > >>  > 
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
>>  > >>  > To: users@tomee.apache.org
>>  > >>  > Subject: Re: OpenEJB and EL
>>  > >>  >
>>  > >>  > +1
>>  > >>  >
>>  > >>  > means
>>  > >>  >
>>  > >>  > @RequestScoped
>>  > >>  >
>>  > >>  > public class ConversationWrapper {
>>  > >>  >   private @Inject Conversation conv;
>>  > >>  >
>>  > >>  >   @Produces
>>  > >>  >   @Dependent
>>  > >>  >   @Named("conv")
>>  > >>  >
>>  > >>  >   public Conversation getConv() {
>>  > >>  >     return conv;
>>  > >>  >   }
>>  > >>  > }
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  >
>>  > >>  > On Wednesday, 28 September 2016, 23:10, Romain 
> Manni-Bucau <
>>  > >>  > rmannibucau@gmail.com> wrote:
>>  > >>  >
>>  > >>  >
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >a producer allows to get a shorter/more elegant 
> naming like
>>  > > #{conv.id}
>>  > >>  > if you @Produces @Named("conv") ;)
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >Romain Manni-Bucau
>>  > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github 
> | LinkedIn |
>>  > >>  > Tomitriber | JavaEE Factory
>>  > >>  > >
>>  > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
>>  > > <st...@yahoo.de.invalid>:
>>  > >>  > >
>>  > >>  > >Oh boy, sorry for you. You did hit a blank spot in 
> the CDI spec.
>>  > >>  > >>
>>  > >>  > >>Problem is that the EE umbrella spec, the EL 
> spec and the CDI
>>  > > spec
>>  > >>  > contradict each other.
>>  > >>  > >>
>>  > >>  > >>The Weld guys solved this by introducing a 
> Javax class. But
>>  > > that takes
>>  > >>  > away the whole javax.* tree for the EL. That's just 
> not good as it
>>  > >>  > contradicts the EL spec.
>>  > >>  > >>
>>  > >>  > >>Could you please try the following
>>  > >>  > >>
>>  > >>  > >>@RequestScoped
>>  > >>  > >>@Named("conversation")
>>  > >>  > >>public class ConversationWrapper {
>>  > >>  > >>   private @Inject Conversation conv;
>>  > >>  > >>
>>  > >>  > >>  public Conversation get() {
>>  > >>  > >>       return conv;
>>  > >>  > >>   }
>>  > >>  > >>}
>>  > >>  > >>
>>  > >>  > >>And in the EL just use 
> #{conversation.get.id}
>>  > >>  > >>
>>  > >>  > >>LieGrue,
>>  > >>  > >>strub
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>
>>  > >>  > >>> On Wednesday, 28 September 2016, 22:12, 
> Xavier Dury <
>>  > >>  > kalgon@hotmail.com> wrote:
>>  > >>  > >>> > I really don't understand how 
> something like
>>  > > <f:param
>>  > >>  > >>> name="cid"
>>  > >>  > >>> value="#{javax.enterprise.
>>  > > context.conversation.id}"/> actually
>>  > >>  > >>> works... something must be made to make 
> the EL processor
>>  > > accept that
>>  > >>  > invalid
>>  > >>  > >>> bean name.
>>  > >>  > >>>
>>  > >>  > >>> Making a producer which @Produces @Named 
> Conversation
>>  > > conflicts with
>>  > >>  > the
>>  > >>  > >>> built-in bean from OWB (with 
> WebBeanType.CONVERSATION)...
>>  > >>  > >>>
>>  > >>  > >>> ... so, I have done the following for my 
> tests but I feel
>>  > > a bit
>>  > >>  > ashamed because
>>  > >>  > >>> I can't imagine there is no better 
> solution than this
>>  > > ;-)
>>  > >>  > >>>
>>  > >>  > >>> public class ConversationAliaser {
>>  > >>  > >>>     public class Javax {
>>  > >>  > >>>         public Enterprise getEnterprise() 
> {return
>>  > > new Enterprise();}
>>  > >>  > >>>
>>  > >>  > >>>     }
>>  > >>  > >>>     public class Enterprise {
>>  > >>  > >>>         public Context getContext() 
> {return new
>>  > > Context();}
>>  > >>  > >>>     }
>>  > >>  > >>>     public class Context {
>>  > >>  > >>>         public Conversation 
> getConversation()
>>  > > {return conversation;}
>>  > >>  > >>>
>>  > >>  > >>>     }
>>  > >>  > >>>     @Inject
>>  > >>  > >>>     private Conversation conversation;
>>  > >>  > >>>     @Produces @ApplicationScoped
>>  > > @Named("javax")
>>  > >>  > >>>     public Javax javax() {return new 
> Javax();}
>>  > >>  > >>> }
>>  > >>  > >>>
>>  > >>  > >>> But that works!
>>  > >>  > >>>
>>  > >>  > >>> Xavier
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> From: Xavier Dury 
> <ka...@hotmail.com>
>>  > >>  > >>> Sent: Wednesday, September 28, 2016 8:42 
> PM
>>  > >>  > >>> To: users@tomee.apache.org
>>  > >>  > >>> Subject: Re: OpenEJB and EL
>>  > >>  > >>>
>>  > >>  > >>> Hmmm... I guess I'll have to @Produces 
> @Named the
>>  > > conversation if I
>>  > >>  > want to
>>  > >>  > >>> use it in ELs. I don't know if 
> something like
>>  > >>  > >>> #{applicationScope['javax. 
> enterprise.context.
>>  > >>  > conversation'].transient}
>>  > >>  > >>> would work?
>>  > >>  > >>>
>>  > >>  > >>> I remember back in my JSP days that, 
> sometimes, I had to
>>  > > use
>>  > >>  something
>>  > >>  > like
>>  > >>  > >>> ${requestScope['javax.servlet.
>>  > > forward.request_uri']} instead of
>>  > >>  > >>> plain ${javax.servlet.forward. 
> request_uri}.
>>  > >>  > >>>
>>  > >>  > >>> Xavier
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> From: Romain Manni-Bucau 
> <rm...@gmail.com>
>>  > >>  > >>> Sent: Wednesday, September 28, 2016 6:54 
> PM
>>  > >>  > >>> To: users@tomee.apache.org
>>  > >>  > >>> Subject: Re: OpenEJB and EL
>>  > >>  > >>>
>>  > >>  > >>> hmm, wonder if it is linked to the value 
> you try to
>>  > > evaluate (which
>>  > >>  > doesn't
>>  > >>  > >>> respect EL spec even if in CDI spec - 
> don't ask
>>  > > please ;)).. See
>>  > >>  > >>> https://issues.jboss.org/ 
> browse/CDITCK-462 /
>>  > >>  >
>>  > >>  >
>>  > >>  > System Dashboard - JBoss Issue Tracker
>>  > >>  > issues.jboss.org
>>  > >>  > Atlassian JIRA Project Management Software
>>  > > (v6.4.11#64026-sha1:78f6ec4)
>>  > >>  > About JIRA; Report a problem; Powered by a free 
> Atlassian JIRA open
>>  > >>  source
>>  > >>  > license for Red Hat ...
>>  > >>  > >>> http://lists.jboss.org/ 
> pipermail/cdi-dev/2015-
>>  > > January/006009.html
>>  > >>  >
>>  > >>  >
>>  > >>  > lists.jboss.org Mailing Lists
>>  > >>  > lists.jboss.org
>>  > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a 
> listing of all
>>  > the
>>  > >>  > public mailing lists on lists.jboss.org. Click on a 
> list name to
>>  get
>>  > >>  more
>>  > >>  > information ...
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> Romain Manni-Bucau
>>  > >>  > >>> @rmannibucau <https://twitter.com/ 
> rmannibucau> |
>>  > > Blog
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>>
>>  > >>  > >>> Romain Manni-Bucau (@rmannibucau) | 
> Twitter
>>  > >>  > >>> twitter.com
>>  > >>  > >>> The latest Tweets from Romain Manni-Bucau 
> (@rmannibucau).
>>  > > ASF /
>>  > >>  > Java(EE) /
>>  > >>  > >>> Angular. LinkedIn: 
> https://t.co/dX7XMGjbBi. JavaEE
>>  > > Factory:
>>  > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
>>  > >>  > >>> <https://blog-rmannibucau. 
> rhcloud.com> | Old
>>  > > Wordpress Blog
>>  > >>  > >>> <http://rmannibucau.wordpress. com> 
> | Github
>>  > >>  > >>> <https://github.com/ rmannibucau> |
>>  > >>  > >>> LinkedIn <https://www.linkedin.com/in/ 
> rmannibucau>
>>  > > | Tomitriber
>>  > >>  > >>> <http://www.tomitribe.com> | JavaEE 
> Factory
>>  > >>  > >>> <https://javaeefactory- 
> rmannibucau.rhcloud.com>
>>  > >>  > >>>
>>  > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
>>  > > <ka...@hotmail.com>:
>>  > >>  > >>>
>>  > >>  > >>>>  Hi Romain,
>>  > >>  > >>>>
>>  > >>  > >>>>  I tried with 
> org.apache.tomcat:tomcat-
>>  > > jasper-el:8.5.5 but it does
>>  > >>  > not
>>  > >>  > >>>>  parse my expression until I change
>>  > > ".transient" by
>>  > >>  > >>> ".isTransient()" and
>>  > >>  > >>>>  then it gives the same error: 
> javax.el.
>>  > > PropertyNotFoundException:
>>  > >>  > >>>>  ELResolver cannot handle a null base 
> Object with
>>  > > identifier
>>  > >>  > >>> 'javax'.
>>  > >>  > >>>>
>>  > >>  > >>>>  Does the EL context need something 
> else than adding
>>  > > the
>>  > >>  > >>>>  BeanManager.getELResolver()  to be 
> able to resolve
>>  > > some implicit
>>  > >>  > objects? I
>>  > >>  > >>>>  don't understand why it works 
> with ri-1.0.
>>  > >>  > >>>>
>>  > >>  > >>>>  Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>
>>  > >>  > >>>>  From: Romain Manni-Bucau
>>  > > <rm...@gmail.com>
>>  > >>  > >>>>  Sent: Wednesday, September 28, 2016 
> 4:02 PM
>>  > >>  > >>>>  To: users@tomee.apache.org
>>  > >>  > >>>>  Subject: Re: OpenEJB and EL
>>  > >>  > >>>>
>>  > >>  > >>>>  Hi Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>  On the phone so hard to give you a 
> link bit try
>>  > > using tomcat el
>>  > >>  impl
>>  > >>  > of
>>  > >>  > >>>>  tomcat 8.5
>>  > >>  > >>>>
>>  > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier 
> Dury"
>>  > > <ka...@hotmail.com>
>>  > >>  > >>> a écrit :
>>  > >>  > >>>>
>>  > >>  > >>>>  > Hi,
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > I am using OpenEJB for my tests 
> and need
>>  > > support for EL
>>  > >>  > expressions in
>>  > >>  > >>> my
>>  > >>  > >>>>  > own code.
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > By default, if I do something 
> like this (pay
>>  > > attention to the
>>  > >>  > >>>>  expression):
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > ExpressionFactory factory = 
> beanManager.
>>  > > wrapExpressionFactory(
>>  > >>  > >>>>  > ExpressionFactory.newInstance( 
> ));
>>  > >>  > >>>>  > StandardELContext elContext = 
> new
>>  > > StandardELContext(factory);
>>  > >>  > >>>>  > elContext.addELResolver(
>>  > > beanManager.getELResolver());
>>  > >>  > >>>>  > ValueExpression expression =
>>  > > factory.createValueExpression(
>>  > >>  > elContext,
>>  > >>  > >>>>  > 
> "#{javax.enterprise.context.
>>  > > conversation.transient}",
>>  > >>  > >>> Boolean.class);
>>  > >>  > >>>>  > expression.getValue(elContext) ;
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > and only add 
> org.apache.tomee:openejb-core:
>>  > > 7.0.1 to my project
>>  > >>  > then I
>>  > >>  > >>>>  get
>>  > >>  > >>>>  > javax.el.ELException: Unable to 
> find
>>  > > ExpressionFactory of type:
>>  > >>  > >>>>  > org.apache.el. 
> ExpressionFactoryImpl
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > if I add 
> org.glassfish:javax.el:3.0.0 then I
>>  > > get javax.el.
>>  > >>  > >>>>  PropertyNotFoundException:
>>  > >>  > >>>>  > ELResolver cannot handle a null 
> base Object
>>  > > with identifier
>>  > >>  > >>> 'javax'
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > if I switch the EL library to
>>  > > com.sun.el:el-ri:1.0 (+
>>  > >>  > >>> META-INF/javax.el.
>>  > >>  > >>>>  ExpressionFactory
>>  > >>  > >>>>  > < com.sun.el. 
> ExpressionFactoryImpl) then my
>>  > > expression can be
>>  > >>  > >>> evaluated
>>  > >>  > >>>>  > but I can't use any new 
> feature of 3.0
>>  > > (like lambdas)
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > So, either my dependencies are 
> wrong or I am
>>  > > not correctly
>>  > >>  > >>> initializing
>>  > >>  > >>>>  my
>>  > >>  > >>>>  > factory.
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Does anybody have an idea?
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Thanks,
>>  > >>  > >>>>  >
>>  > >>  > >>>>  > Xavier
>>  > >>  > >>>>
>>  > >>  > >>>>
>>  > >>  > >>>
>>  > >>  > >>
>>  > >>  > >
>>  > >>  > >
>>  > >>  > >
>>  > >>  >
>>  > >>  >
>>  > >>
>>  > >>
>>  > >
>>  >
>>  >
>> 
>> 
> 

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-09-29 9:15 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Indeed, @Named != named... got it! :-)
>
> But I still fail to understand _where_ the workaround for 'javax...' is
> actually implemented:
>
>
nowhere cause it introduces other issues in EL so the workaround is only a
workaround not a nasty way to get a feature.


> 1) if it is implemented in OWB then why is 'elContext.addELResolver(beanManager.getELResolver());'
> not working? I would expect the returned el resolver to contain the
> workaround.
> 2) if it is implemented elsewhere (TomEE for example), I don't understand
> why as this requirement comes from the CDI spec and should be implemented
> in OWB... so back to (1)
>
> I am stuck in an infinite loop ;-)
>
>
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Thursday, September 29, 2016 8:54 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> 2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> > @Mark
> >
> > thanks, it works when adding any other qualifier!
> >
> > btw, do you think it would hurt to qualify the built-in conversation bean
> > with @Named("javax.enterprise.context.conversation") in OWB? That way I
> > could inject the built-in with @Inject @Named("javax.enteprise.
> context.conversation")
> > and expose it via @Produces @Named("conversation") without resorting to
> > some extra qualifier.
> >
> > @Romain
> >
> > I was wondering where exactly is your hacky el resolver implemented? If
> > the "javax.enterprise.context.conversation" name is a requirement coming
> > from the CDI spec, then I would suppose it is implemented in OWB (in the
> > resolver you get from the BeanManager) but as my tests with OEJB+OWB
> fail,
> > I suppose it is not there (or not enabled in some way). On the contrary,
> if
> > the requirement comes from the java EE spec, then I suppose it is
> > implemented in TomEE and that would explain why my tests fail.
> >
> >
> The name is built it in openwebbeans:
> https://github.com/apache/openwebbeans/blob/trunk/
> webbeans-impl/src/main/java/org/apache/webbeans/component/
> ConversationBean.java#L54
>
> The spec states:
>
> "The container provides a built-in bean with bean type Conversation, scope
> @RequestScoped, and qualifier@Default, named
> javax.enterprise.context.conversation."
>
> So no qualifier @Named but a Bean<?> name (no comment ;))
>
>
> > Xavier
> >
> >
> >
> >
> > From: Mark Struberg <st...@yahoo.de.INVALID>
> > Sent: Thursday, September 29, 2016 12:12 AM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > @Default is always assumed when you don't add a specific Qualifier other
> > than @Named and @Any.
> >
> > Xavier, can you please add any random qualifier? E.g. @Destroyed.
> >
> > This will stop CDI from complaining but EL should work.
> >
> > LieGrue,
> > strub
> >
> >
> >
> >
> >
> > > On Thursday, 29 September 2016, 0:04, Xavier Dury <ka...@hotmail.com>
> > wrote:
> > > > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
>
>
>
> OpenEjbElTest.java
> gist.github.com
> property=
> >
> >
> >
> > OpenEjbElTest.java
> > gist.github.com
> > property=
> > >
> > >
> > >
> > > From: Xavier Dury <ka...@hotmail.com>
> > > Sent: Wednesday, September 28, 2016 11:54 PM
> > > To: users@tomee.apache.org
> > > Subject: Re: OpenEJB and EL
> > >
> > > No, I didn't add the @Default to the @Produces method.
> > >
> > > I verified:
> > >
> > > @RequestScoped
> > > public class ConversationWrapper {
> > >
> > >         private @Inject Conversation conv;
> > >
> > >         @Produces
> > >         @Dependent
> > >         @Named("conv")
> > >         public Conversation getConv() {
> > >                 return conv;
> > >         }
> > > }
> > >
> > > result:
> > >
> > > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> > is more
> > > than one Bean with type javax.enterprise.context.
> ConversationQualifiers:
> > > [@javax.enterprise.inject.Default()]
> > > for injection into Field Injection Point, field name :  conv, Bean
> Owner
> > :
> > > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > > Types:[java.lang.Object,eg.ConversationWrapper],
> > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any]]
> > > found beans:
> > > ConversationImpl, WebBeansType:CONVERSATION,
> > > Name:javax.enterprise.context.conversation, API
> > > Types:[java.lang.Object,org.apache.webbeans.conversation.
> > ConversationImpl,javax.enterprise.context.Conversation],
> > > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]
> > from
> > > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named]
> > > from
> > > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> > ConversationWrapper.class
> > >
> > >
> > >
> > >
> > > From: Romain Manni-Bucau <rm...@gmail.com>
> > > Sent: Wednesday, September 28, 2016 11:47 PM
> > > To: users@tomee.apache.org
> > > Subject: Re: OpenEJB and EL
> > >
> > > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > > Qualifiers:[javax.enterprise.inject.Default,javax.
> > > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> > >
> > > Why is there @Default there? producer should only have the @Named you
> set
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > >
> > >
> > >
> > > Romain Manni-Bucau (@rmannibucau) | Twitter
> > > twitter.com
> > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE)
> > /
> > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > > https://t.co/0VnvWwbedt . Blog ...
> > >
> > >
> > >
> > > Romain Manni-Bucau (@rmannibucau) | Twitter
> > > twitter.com
> > > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE)
> > /
> > > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > > https://t.co/0VnvWwbedt . Blog ...
> > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > >
> > >
> > > RBlog: the RManniBucau v2 Blog
> > > blog-rmannibucau.rhcloud.com
> > > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> > Source,
> > > Code and geeky topics...
> > > <http://rmannibucau.wordpress.com> | Github
> > > <https://github.com/rmannibucau> |
> > >
> > >
> > > [old blog] new RManniBucau().blog()
> > > rmannibucau.wordpress.com
> > > New blog on: https://blog-rmannibucau.rhcloud.com/
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com> | JavaEE Factory
> > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > >
> > > 2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >
> > >>  It seems that to inject the conversation in
> > > ConversationWrapper.conversation,
> > >>  OWB does consider both the build-in conversation bean and the
> produced
> > one
> > >>  from... ConversationWrapper.getConv().
> > >>
> > >>  I tried something like that:
> > >>
> > >>  @RequestScoped
> > >>  public class ConversationWrapper {
> > >>
> > >>          private @Inject
> > > @Named("javax.enterprise.context.conversation")
> > >>  Conversation conv;
> > >>
> > >>          @Produces
> > >>          @Dependent
> > >>          @Named("conv")
> > >>          public Conversation getConv() {
> > >>                  return conv;
> > >>          }
> > >>  }
> > >>
> > >>  But it gives the following error:
> > >>
> > >>  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException:
> Api
> > >>  type [javax.enterprise.context.Conversation] is not found with the
> > >>  qualifiers
> > >>  Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> > >>  conversation)]
> > >>  for injection into Field Injection Point, field name :  conv, Bean
> > Owner :
> > >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > >>  Types:[eg.ConversationWrapper,java.lang.Object],
> > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any]]
> > >>
> > >>
> > >>
> > >>
> > >>  From: Xavier Dury <ka...@hotmail.com>
> > >>  Sent: Wednesday, September 28, 2016 11:34 PM
> > >>  To: users@tomee.apache.org
> > >>  Subject: Re: OpenEJB and EL
> > >>
> > >>  Got the same result with 'conv':
> > >>
> > >>  Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> > There is
> > >>  more than one Bean with type
> > > javax.enterprise.context.ConversationQualifiers:
> > >>  [@javax.enterprise.inject.Default()]
> > >>  for injection into Field Injection Point, field name :  conversation,
> > Bean
> > >>  Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> > >>  Types:[java.lang.Object,eg.ConversationAliaser],
> > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any]]
> > >>  found beans:
> > >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > >>  Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > >>  workspaces/openejb-el/target/test-classes/eg/
> ConversationWrapper.class
> > >>  ConversationImpl, WebBeansType:CONVERSATION,
> > > Name:javax.enterprise.context.conversation,
> > >>  API Types:[org.apache.webbeans.conversation.ConversationImpl,
> > >>  javax.enterprise.context.Conversation,java.lang.Object],
> > >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any]
> > >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > >>  1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>  Sent: Wednesday, September 28, 2016 11:29 PM
> > >>  To: users@tomee.apache.org
> > >>  Cc: Mark Struberg
> > >>  Subject: Re: OpenEJB and EL
> > >>
> > >>  missing @Named("conv")?
> > >>
> > >>
> > >>  Romain Manni-Bucau
> > >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >>
> > >>
> > >>
> > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  twitter.com
> > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  https://t.co/0VnvWwbedt . Blog ...
> > >>
> > >>
> > >>
> > >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  twitter.com
> > >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>  https://t.co/0VnvWwbedt . Blog ...
> > >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > >>
> > >>
> > >>  RBlog: the RManniBucau v2 Blog
> > >>  blog-rmannibucau.rhcloud.com
> > >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular,
> Open
> > >>  Source, Code and geeky topics...
> > >>  <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > >>  rmannibucau> |
> > >>
> > >>
> > >>  [old blog] new RManniBucau().blog()
> > >>  rmannibucau.wordpress.com
> > >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> > >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > >>  <http://www.tomitribe.com> | JavaEE Factory
> > >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> > >>
> > >>  2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >>
> > >>  >
> > >>  > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> > There
> > >>  is
> > >>  > more than one Bean with type javax.enterprise.context.
> > >>  ConversationQualifiers:
> > >>  > [@javax.enterprise.inject.Default()]
> > >>  > for injection into Field Injection Point, field name :
> conversation,
> > >>  Bean
> > >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> > >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  enterprise.inject.Any]]
> > >>  > found beans:
> > >>  > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> > >>  > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> > >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> > >>  > enterprise.inject.Any,javax.inject.Named] from
> file:/D:/development/
> > >>  > workspaces/openejb-el/target/test-classes/eg/
> > ConversationWrapper.class
> > >>  > ConversationImpl, WebBeansType:CONVERSATION,
> > >>  Name:javax.enterprise.context.conversation,
> > >>  > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> > >>  > javax.enterprise.context.Conversation,java.lang.Object],
> > >>  >
> > > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]
> > >>  > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> > >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> > >>  > To: users@tomee.apache.org
> > >>  > Subject: Re: OpenEJB and EL
> > >>  >
> > >>  > +1
> > >>  >
> > >>  > means
> > >>  >
> > >>  > @RequestScoped
> > >>  >
> > >>  > public class ConversationWrapper {
> > >>  >   private @Inject Conversation conv;
> > >>  >
> > >>  >   @Produces
> > >>  >   @Dependent
> > >>  >   @Named("conv")
> > >>  >
> > >>  >   public Conversation getConv() {
> > >>  >     return conv;
> > >>  >   }
> > >>  > }
> > >>  >
> > >>  >
> > >>  >
> > >>  >
> > >>  > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> > >>  > rmannibucau@gmail.com> wrote:
> > >>  >
> > >>  >
> > >>  > >
> > >>  > >
> > >>  > >a producer allows to get a shorter/more elegant naming like
> > > #{conv.id}
> > >>  > if you @Produces @Named("conv") ;)
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  > >Romain Manni-Bucau
> > >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> > >>  > Tomitriber | JavaEE Factory
> > >>  > >
> > >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> > > <st...@yahoo.de.invalid>:
> > >>  > >
> > >>  > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> > >>  > >>
> > >>  > >>Problem is that the EE umbrella spec, the EL spec and the CDI
> > > spec
> > >>  > contradict each other.
> > >>  > >>
> > >>  > >>The Weld guys solved this by introducing a Javax class. But
> > > that takes
> > >>  > away the whole javax.* tree for the EL. That's just not good as it
> > >>  > contradicts the EL spec.
> > >>  > >>
> > >>  > >>Could you please try the following
> > >>  > >>
> > >>  > >>@RequestScoped
> > >>  > >>@Named("conversation")
> > >>  > >>public class ConversationWrapper {
> > >>  > >>   private @Inject Conversation conv;
> > >>  > >>
> > >>  > >>  public Conversation get() {
> > >>  > >>       return conv;
> > >>  > >>   }
> > >>  > >>}
> > >>  > >>
> > >>  > >>And in the EL just use #{conversation.get.id}
> > >>  > >>
> > >>  > >>LieGrue,
> > >>  > >>strub
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>
> > >>  > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> > >>  > kalgon@hotmail.com> wrote:
> > >>  > >>> > I really don't understand how something like
> > > <f:param
> > >>  > >>> name="cid"
> > >>  > >>> value="#{javax.enterprise.
> > > context.conversation.id}"/> actually
> > >>  > >>> works... something must be made to make the EL processor
> > > accept that
> > >>  > invalid
> > >>  > >>> bean name.
> > >>  > >>>
> > >>  > >>> Making a producer which @Produces @Named Conversation
> > > conflicts with
> > >>  > the
> > >>  > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> > >>  > >>>
> > >>  > >>> ... so, I have done the following for my tests but I feel
> > > a bit
> > >>  > ashamed because
> > >>  > >>> I can't imagine there is no better solution than this
> > > ;-)
> > >>  > >>>
> > >>  > >>> public class ConversationAliaser {
> > >>  > >>>     public class Javax {
> > >>  > >>>         public Enterprise getEnterprise() {return
> > > new Enterprise();}
> > >>  > >>>
> > >>  > >>>     }
> > >>  > >>>     public class Enterprise {
> > >>  > >>>         public Context getContext() {return new
> > > Context();}
> > >>  > >>>     }
> > >>  > >>>     public class Context {
> > >>  > >>>         public Conversation getConversation()
> > > {return conversation;}
> > >>  > >>>
> > >>  > >>>     }
> > >>  > >>>     @Inject
> > >>  > >>>     private Conversation conversation;
> > >>  > >>>     @Produces @ApplicationScoped
> > > @Named("javax")
> > >>  > >>>     public Javax javax() {return new Javax();}
> > >>  > >>> }
> > >>  > >>>
> > >>  > >>> But that works!
> > >>  > >>>
> > >>  > >>> Xavier
> > >>  > >>>
> > >>  > >>>
> > >>  > >>>
> > >>  > >>> From: Xavier Dury <ka...@hotmail.com>
> > >>  > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> > >>  > >>> To: users@tomee.apache.org
> > >>  > >>> Subject: Re: OpenEJB and EL
> > >>  > >>>
> > >>  > >>> Hmmm... I guess I'll have to @Produces @Named the
> > > conversation if I
> > >>  > want to
> > >>  > >>> use it in ELs. I don't know if something like
> > >>  > >>> #{applicationScope['javax. enterprise.context.
> > >>  > conversation'].transient}
> > >>  > >>> would work?
> > >>  > >>>
> > >>  > >>> I remember back in my JSP days that, sometimes, I had to
> > > use
> > >>  something
> > >>  > like
> > >>  > >>> ${requestScope['javax.servlet.
> > > forward.request_uri']} instead of
> > >>  > >>> plain ${javax.servlet.forward. request_uri}.
> > >>  > >>>
> > >>  > >>> Xavier
> > >>  > >>>
> > >>  > >>>
> > >>  > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> > >>  > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> > >>  > >>> To: users@tomee.apache.org
> > >>  > >>> Subject: Re: OpenEJB and EL
> > >>  > >>>
> > >>  > >>> hmm, wonder if it is linked to the value you try to
> > > evaluate (which
> > >>  > doesn't
> > >>  > >>> respect EL spec even if in CDI spec - don't ask
> > > please ;)).. See
> > >>  > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> > >>  >
> > >>  >
> > >>  > System Dashboard - JBoss Issue Tracker
> > >>  > issues.jboss.org
> > >>  > Atlassian JIRA Project Management Software
> > > (v6.4.11#64026-sha1:78f6ec4)
> > >>  > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> > >>  source
> > >>  > license for Red Hat ...
> > >>  > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015-
> > > January/006009.html
> > >>  >
> > >>  >
> > >>  > lists.jboss.org Mailing Lists
> > >>  > lists.jboss.org
> > >>  > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all
> > the
> > >>  > public mailing lists on lists.jboss.org. Click on a list name to
> get
> > >>  more
> > >>  > information ...
> > >>  > >>>
> > >>  > >>>
> > >>  > >>>
> > >>  > >>>
> > >>  > >>> Romain Manni-Bucau
> > >>  > >>> @rmannibucau <https://twitter.com/ rmannibucau> |
> > > Blog
> > >>  > >>>
> > >>  > >>>
> > >>  > >>>
> > >>  > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>  > >>> twitter.com
> > >>  > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > > ASF /
> > >>  > Java(EE) /
> > >>  > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE
> > > Factory:
> > >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> > >>  > >>> <https://blog-rmannibucau. rhcloud.com> | Old
> > > Wordpress Blog
> > >>  > >>> <http://rmannibucau.wordpress. com> | Github
> > >>  > >>> <https://github.com/ rmannibucau> |
> > >>  > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau>
> > > | Tomitriber
> > >>  > >>> <http://www.tomitribe.com> | JavaEE Factory
> > >>  > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> > >>  > >>>
> > >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> > > <ka...@hotmail.com>:
> > >>  > >>>
> > >>  > >>>>  Hi Romain,
> > >>  > >>>>
> > >>  > >>>>  I tried with org.apache.tomcat:tomcat-
> > > jasper-el:8.5.5 but it does
> > >>  > not
> > >>  > >>>>  parse my expression until I change
> > > ".transient" by
> > >>  > >>> ".isTransient()" and
> > >>  > >>>>  then it gives the same error: javax.el.
> > > PropertyNotFoundException:
> > >>  > >>>>  ELResolver cannot handle a null base Object with
> > > identifier
> > >>  > >>> 'javax'.
> > >>  > >>>>
> > >>  > >>>>  Does the EL context need something else than adding
> > > the
> > >>  > >>>>  BeanManager.getELResolver()  to be able to resolve
> > > some implicit
> > >>  > objects? I
> > >>  > >>>>  don't understand why it works with ri-1.0.
> > >>  > >>>>
> > >>  > >>>>  Xavier
> > >>  > >>>>
> > >>  > >>>>
> > >>  > >>>>  From: Romain Manni-Bucau
> > > <rm...@gmail.com>
> > >>  > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> > >>  > >>>>  To: users@tomee.apache.org
> > >>  > >>>>  Subject: Re: OpenEJB and EL
> > >>  > >>>>
> > >>  > >>>>  Hi Xavier
> > >>  > >>>>
> > >>  > >>>>  On the phone so hard to give you a link bit try
> > > using tomcat el
> > >>  impl
> > >>  > of
> > >>  > >>>>  tomcat 8.5
> > >>  > >>>>
> > >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury"
> > > <ka...@hotmail.com>
> > >>  > >>> a écrit :
> > >>  > >>>>
> > >>  > >>>>  > Hi,
> > >>  > >>>>  >
> > >>  > >>>>  > I am using OpenEJB for my tests and need
> > > support for EL
> > >>  > expressions in
> > >>  > >>> my
> > >>  > >>>>  > own code.
> > >>  > >>>>  >
> > >>  > >>>>  > By default, if I do something like this (pay
> > > attention to the
> > >>  > >>>>  expression):
> > >>  > >>>>  >
> > >>  > >>>>  > ExpressionFactory factory = beanManager.
> > > wrapExpressionFactory(
> > >>  > >>>>  > ExpressionFactory.newInstance( ));
> > >>  > >>>>  > StandardELContext elContext = new
> > > StandardELContext(factory);
> > >>  > >>>>  > elContext.addELResolver(
> > > beanManager.getELResolver());
> > >>  > >>>>  > ValueExpression expression =
> > > factory.createValueExpression(
> > >>  > elContext,
> > >>  > >>>>  > "#{javax.enterprise.context.
> > > conversation.transient}",
> > >>  > >>> Boolean.class);
> > >>  > >>>>  > expression.getValue(elContext) ;
> > >>  > >>>>  >
> > >>  > >>>>  > and only add org.apache.tomee:openejb-core:
> > > 7.0.1 to my project
> > >>  > then I
> > >>  > >>>>  get
> > >>  > >>>>  > javax.el.ELException: Unable to find
> > > ExpressionFactory of type:
> > >>  > >>>>  > org.apache.el. ExpressionFactoryImpl
> > >>  > >>>>  >
> > >>  > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I
> > > get javax.el.
> > >>  > >>>>  PropertyNotFoundException:
> > >>  > >>>>  > ELResolver cannot handle a null base Object
> > > with identifier
> > >>  > >>> 'javax'
> > >>  > >>>>  >
> > >>  > >>>>  > if I switch the EL library to
> > > com.sun.el:el-ri:1.0 (+
> > >>  > >>> META-INF/javax.el.
> > >>  > >>>>  ExpressionFactory
> > >>  > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my
> > > expression can be
> > >>  > >>> evaluated
> > >>  > >>>>  > but I can't use any new feature of 3.0
> > > (like lambdas)
> > >>  > >>>>  >
> > >>  > >>>>  > So, either my dependencies are wrong or I am
> > > not correctly
> > >>  > >>> initializing
> > >>  > >>>>  my
> > >>  > >>>>  > factory.
> > >>  > >>>>  >
> > >>  > >>>>  > Does anybody have an idea?
> > >>  > >>>>  >
> > >>  > >>>>  > Thanks,
> > >>  > >>>>  >
> > >>  > >>>>  > Xavier
> > >>  > >>>>
> > >>  > >>>>
> > >>  > >>>
> > >>  > >>
> > >>  > >
> > >>  > >
> > >>  > >
> > >>  >
> > >>  >
> > >>
> > >>
> > >
> >
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Indeed, @Named != named... got it! :-)

But I still fail to understand _where_ the workaround for 'javax...' is actually implemented:

1) if it is implemented in OWB then why is 'elContext.addELResolver(beanManager.getELResolver());' not working? I would expect the returned el resolver to contain the workaround.
2) if it is implemented elsewhere (TomEE for example), I don't understand why as this requirement comes from the CDI spec and should be implemented in OWB... so back to (1)

I am stuck in an infinite loop ;-)




From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Thursday, September 29, 2016 8:54 AM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> @Mark
>
> thanks, it works when adding any other qualifier!
>
> btw, do you think it would hurt to qualify the built-in conversation bean
> with @Named("javax.enterprise.context.conversation") in OWB? That way I
> could inject the built-in with @Inject @Named("javax.enteprise.context.conversation")
> and expose it via @Produces @Named("conversation") without resorting to
> some extra qualifier.
>
> @Romain
>
> I was wondering where exactly is your hacky el resolver implemented? If
> the "javax.enterprise.context.conversation" name is a requirement coming
> from the CDI spec, then I would suppose it is implemented in OWB (in the
> resolver you get from the BeanManager) but as my tests with OEJB+OWB fail,
> I suppose it is not there (or not enabled in some way). On the contrary, if
> the requirement comes from the java EE spec, then I suppose it is
> implemented in TomEE and that would explain why my tests fail.
>
>
The name is built it in openwebbeans:
https://github.com/apache/openwebbeans/blob/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java#L54

The spec states:

"The container provides a built-in bean with bean type Conversation, scope
@RequestScoped, and qualifier@Default, named
javax.enterprise.context.conversation."

So no qualifier @Named but a Bean<?> name (no comment ;))


> Xavier
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 12:12 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> @Default is always assumed when you don't add a specific Qualifier other
> than @Named and @Any.
>
> Xavier, can you please add any random qualifier? E.g. @Destroyed.
>
> This will stop CDI from complaining but EL should work.
>
> LieGrue,
> strub
>
>
>
>
>
> > On Thursday, 29 September 2016, 0:04, Xavier Dury <ka...@hotmail.com>
> wrote:
> > > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf



OpenEjbElTest.java
gist.github.com
property=
>
>
>
> OpenEjbElTest.java
> gist.github.com
> property=
> >
> >
> >
> > From: Xavier Dury <ka...@hotmail.com>
> > Sent: Wednesday, September 28, 2016 11:54 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > No, I didn't add the @Default to the @Produces method.
> >
> > I verified:
> >
> > @RequestScoped
> > public class ConversationWrapper {
> >
> >         private @Inject Conversation conv;
> >
> >         @Produces
> >         @Dependent
> >         @Named("conv")
> >         public Conversation getConv() {
> >                 return conv;
> >         }
> > }
> >
> > result:
> >
> > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> is more
> > than one Bean with type javax.enterprise.context.ConversationQualifiers:
> > [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :  conv, Bean Owner
> :
> > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > Types:[java.lang.Object,eg.ConversationWrapper],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> > found beans:
> > ConversationImpl, WebBeansType:CONVERSATION,
> > Name:javax.enterprise.context.conversation, API
> > Types:[java.lang.Object,org.apache.webbeans.conversation.
> ConversationImpl,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from
> > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named]
> > from
> > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> ConversationWrapper.class
> >
> >
> >
> >
> > From: Romain Manni-Bucau <rm...@gmail.com>
> > Sent: Wednesday, September 28, 2016 11:47 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >
> > Why is there @Default there? producer should only have the @Named you set
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >
> >
> > RBlog: the RManniBucau v2 Blog
> > blog-rmannibucau.rhcloud.com
> > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source,
> > Code and geeky topics...
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> |
> >
> >
> > [old blog] new RManniBucau().blog()
> > rmannibucau.wordpress.com
> > New blog on: https://blog-rmannibucau.rhcloud.com/
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  It seems that to inject the conversation in
> > ConversationWrapper.conversation,
> >>  OWB does consider both the build-in conversation bean and the produced
> one
> >>  from... ConversationWrapper.getConv().
> >>
> >>  I tried something like that:
> >>
> >>  @RequestScoped
> >>  public class ConversationWrapper {
> >>
> >>          private @Inject
> > @Named("javax.enterprise.context.conversation")
> >>  Conversation conv;
> >>
> >>          @Produces
> >>          @Dependent
> >>          @Named("conv")
> >>          public Conversation getConv() {
> >>                  return conv;
> >>          }
> >>  }
> >>
> >>  But it gives the following error:
> >>
> >>  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> >>  type [javax.enterprise.context.Conversation] is not found with the
> >>  qualifiers
> >>  Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> >>  conversation)]
> >>  for injection into Field Injection Point, field name :  conv, Bean
> Owner :
> >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  Types:[eg.ConversationWrapper,java.lang.Object],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> >>
> >>
> >>
> >>
> >>  From: Xavier Dury <ka...@hotmail.com>
> >>  Sent: Wednesday, September 28, 2016 11:34 PM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  Got the same result with 'conv':
> >>
> >>  Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> There is
> >>  more than one Bean with type
> > javax.enterprise.context.ConversationQualifiers:
> >>  [@javax.enterprise.inject.Default()]
> >>  for injection into Field Injection Point, field name :  conversation,
> Bean
> >>  Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> >>  Types:[java.lang.Object,eg.ConversationAliaser],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> >>  found beans:
> >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> >>  workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >>  ConversationImpl, WebBeansType:CONVERSATION,
> > Name:javax.enterprise.context.conversation,
> >>  API Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  javax.enterprise.context.Conversation,java.lang.Object],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]
> >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Wednesday, September 28, 2016 11:29 PM
> >>  To: users@tomee.apache.org
> >>  Cc: Mark Struberg
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  missing @Named("conv")?
> >>
> >>
> >>  Romain Manni-Bucau
> >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >>
> >>
> >>  RBlog: the RManniBucau v2 Blog
> >>  blog-rmannibucau.rhcloud.com
> >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> >>  Source, Code and geeky topics...
> >>  <http://rmannibucau.wordpress.com> | Github <https://github.com/
> >>  rmannibucau> |
> >>
> >>
> >>  [old blog] new RManniBucau().blog()
> >>  rmannibucau.wordpress.com
> >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >>  <http://www.tomitribe.com> | JavaEE Factory
> >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> >>
> >>  2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>
> >>  >
> >>  > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> There
> >>  is
> >>  > more than one Bean with type javax.enterprise.context.
> >>  ConversationQualifiers:
> >>  > [@javax.enterprise.inject.Default()]
> >>  > for injection into Field Injection Point, field name :  conversation,
> >>  Bean
> >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]]
> >>  > found beans:
> >>  > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> >>  > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> >>  > workspaces/openejb-el/target/test-classes/eg/
> ConversationWrapper.class
> >>  > ConversationImpl, WebBeansType:CONVERSATION,
> >>  Name:javax.enterprise.context.conversation,
> >>  > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > javax.enterprise.context.Conversation,java.lang.Object],
> >>  >
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> >>  > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> >>  > To: users@tomee.apache.org
> >>  > Subject: Re: OpenEJB and EL
> >>  >
> >>  > +1
> >>  >
> >>  > means
> >>  >
> >>  > @RequestScoped
> >>  >
> >>  > public class ConversationWrapper {
> >>  >   private @Inject Conversation conv;
> >>  >
> >>  >   @Produces
> >>  >   @Dependent
> >>  >   @Named("conv")
> >>  >
> >>  >   public Conversation getConv() {
> >>  >     return conv;
> >>  >   }
> >>  > }
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> >>  > rmannibucau@gmail.com> wrote:
> >>  >
> >>  >
> >>  > >
> >>  > >
> >>  > >a producer allows to get a shorter/more elegant naming like
> > #{conv.id}
> >>  > if you @Produces @Named("conv") ;)
> >>  > >
> >>  > >
> >>  > >
> >>  > >Romain Manni-Bucau
> >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> >>  > Tomitriber | JavaEE Factory
> >>  > >
> >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> > <st...@yahoo.de.invalid>:
> >>  > >
> >>  > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> >>  > >>
> >>  > >>Problem is that the EE umbrella spec, the EL spec and the CDI
> > spec
> >>  > contradict each other.
> >>  > >>
> >>  > >>The Weld guys solved this by introducing a Javax class. But
> > that takes
> >>  > away the whole javax.* tree for the EL. That's just not good as it
> >>  > contradicts the EL spec.
> >>  > >>
> >>  > >>Could you please try the following
> >>  > >>
> >>  > >>@RequestScoped
> >>  > >>@Named("conversation")
> >>  > >>public class ConversationWrapper {
> >>  > >>   private @Inject Conversation conv;
> >>  > >>
> >>  > >>  public Conversation get() {
> >>  > >>       return conv;
> >>  > >>   }
> >>  > >>}
> >>  > >>
> >>  > >>And in the EL just use #{conversation.get.id}
> >>  > >>
> >>  > >>LieGrue,
> >>  > >>strub
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> >>  > kalgon@hotmail.com> wrote:
> >>  > >>> > I really don't understand how something like
> > <f:param
> >>  > >>> name="cid"
> >>  > >>> value="#{javax.enterprise.
> > context.conversation.id}"/> actually
> >>  > >>> works... something must be made to make the EL processor
> > accept that
> >>  > invalid
> >>  > >>> bean name.
> >>  > >>>
> >>  > >>> Making a producer which @Produces @Named Conversation
> > conflicts with
> >>  > the
> >>  > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >>  > >>>
> >>  > >>> ... so, I have done the following for my tests but I feel
> > a bit
> >>  > ashamed because
> >>  > >>> I can't imagine there is no better solution than this
> > ;-)
> >>  > >>>
> >>  > >>> public class ConversationAliaser {
> >>  > >>>     public class Javax {
> >>  > >>>         public Enterprise getEnterprise() {return
> > new Enterprise();}
> >>  > >>>
> >>  > >>>     }
> >>  > >>>     public class Enterprise {
> >>  > >>>         public Context getContext() {return new
> > Context();}
> >>  > >>>     }
> >>  > >>>     public class Context {
> >>  > >>>         public Conversation getConversation()
> > {return conversation;}
> >>  > >>>
> >>  > >>>     }
> >>  > >>>     @Inject
> >>  > >>>     private Conversation conversation;
> >>  > >>>     @Produces @ApplicationScoped
> > @Named("javax")
> >>  > >>>     public Javax javax() {return new Javax();}
> >>  > >>> }
> >>  > >>>
> >>  > >>> But that works!
> >>  > >>>
> >>  > >>> Xavier
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> From: Xavier Dury <ka...@hotmail.com>
> >>  > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> >>  > >>> To: users@tomee.apache.org
> >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>>
> >>  > >>> Hmmm... I guess I'll have to @Produces @Named the
> > conversation if I
> >>  > want to
> >>  > >>> use it in ELs. I don't know if something like
> >>  > >>> #{applicationScope['javax. enterprise.context.
> >>  > conversation'].transient}
> >>  > >>> would work?
> >>  > >>>
> >>  > >>> I remember back in my JSP days that, sometimes, I had to
> > use
> >>  something
> >>  > like
> >>  > >>> ${requestScope['javax.servlet.
> > forward.request_uri']} instead of
> >>  > >>> plain ${javax.servlet.forward. request_uri}.
> >>  > >>>
> >>  > >>> Xavier
> >>  > >>>
> >>  > >>>
> >>  > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> >>  > >>> To: users@tomee.apache.org
> >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>>
> >>  > >>> hmm, wonder if it is linked to the value you try to
> > evaluate (which
> >>  > doesn't
> >>  > >>> respect EL spec even if in CDI spec - don't ask
> > please ;)).. See
> >>  > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> >>  >
> >>  >
> >>  > System Dashboard - JBoss Issue Tracker
> >>  > issues.jboss.org
> >>  > Atlassian JIRA Project Management Software
> > (v6.4.11#64026-sha1:78f6ec4)
> >>  > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> >>  source
> >>  > license for Red Hat ...
> >>  > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015-
> > January/006009.html
> >>  >
> >>  >
> >>  > lists.jboss.org Mailing Lists
> >>  > lists.jboss.org
> >>  > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all
> the
> >>  > public mailing lists on lists.jboss.org. Click on a list name to get
> >>  more
> >>  > information ...
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> Romain Manni-Bucau
> >>  > >>> @rmannibucau <https://twitter.com/ rmannibucau> |
> > Blog
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>> twitter.com
> >>  > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE
> > Factory:
> >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> >>  > >>> <https://blog-rmannibucau. rhcloud.com> | Old
> > Wordpress Blog
> >>  > >>> <http://rmannibucau.wordpress. com> | Github
> >>  > >>> <https://github.com/ rmannibucau> |
> >>  > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau>
> > | Tomitriber
> >>  > >>> <http://www.tomitribe.com> | JavaEE Factory
> >>  > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> >>  > >>>
> >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >>>
> >>  > >>>>  Hi Romain,
> >>  > >>>>
> >>  > >>>>  I tried with org.apache.tomcat:tomcat-
> > jasper-el:8.5.5 but it does
> >>  > not
> >>  > >>>>  parse my expression until I change
> > ".transient" by
> >>  > >>> ".isTransient()" and
> >>  > >>>>  then it gives the same error: javax.el.
> > PropertyNotFoundException:
> >>  > >>>>  ELResolver cannot handle a null base Object with
> > identifier
> >>  > >>> 'javax'.
> >>  > >>>>
> >>  > >>>>  Does the EL context need something else than adding
> > the
> >>  > >>>>  BeanManager.getELResolver()  to be able to resolve
> > some implicit
> >>  > objects? I
> >>  > >>>>  don't understand why it works with ri-1.0.
> >>  > >>>>
> >>  > >>>>  Xavier
> >>  > >>>>
> >>  > >>>>
> >>  > >>>>  From: Romain Manni-Bucau
> > <rm...@gmail.com>
> >>  > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>  > >>>>  To: users@tomee.apache.org
> >>  > >>>>  Subject: Re: OpenEJB and EL
> >>  > >>>>
> >>  > >>>>  Hi Xavier
> >>  > >>>>
> >>  > >>>>  On the phone so hard to give you a link bit try
> > using tomcat el
> >>  impl
> >>  > of
> >>  > >>>>  tomcat 8.5
> >>  > >>>>
> >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury"
> > <ka...@hotmail.com>
> >>  > >>> a écrit :
> >>  > >>>>
> >>  > >>>>  > Hi,
> >>  > >>>>  >
> >>  > >>>>  > I am using OpenEJB for my tests and need
> > support for EL
> >>  > expressions in
> >>  > >>> my
> >>  > >>>>  > own code.
> >>  > >>>>  >
> >>  > >>>>  > By default, if I do something like this (pay
> > attention to the
> >>  > >>>>  expression):
> >>  > >>>>  >
> >>  > >>>>  > ExpressionFactory factory = beanManager.
> > wrapExpressionFactory(
> >>  > >>>>  > ExpressionFactory.newInstance( ));
> >>  > >>>>  > StandardELContext elContext = new
> > StandardELContext(factory);
> >>  > >>>>  > elContext.addELResolver(
> > beanManager.getELResolver());
> >>  > >>>>  > ValueExpression expression =
> > factory.createValueExpression(
> >>  > elContext,
> >>  > >>>>  > "#{javax.enterprise.context.
> > conversation.transient}",
> >>  > >>> Boolean.class);
> >>  > >>>>  > expression.getValue(elContext) ;
> >>  > >>>>  >
> >>  > >>>>  > and only add org.apache.tomee:openejb-core:
> > 7.0.1 to my project
> >>  > then I
> >>  > >>>>  get
> >>  > >>>>  > javax.el.ELException: Unable to find
> > ExpressionFactory of type:
> >>  > >>>>  > org.apache.el. ExpressionFactoryImpl
> >>  > >>>>  >
> >>  > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I
> > get javax.el.
> >>  > >>>>  PropertyNotFoundException:
> >>  > >>>>  > ELResolver cannot handle a null base Object
> > with identifier
> >>  > >>> 'javax'
> >>  > >>>>  >
> >>  > >>>>  > if I switch the EL library to
> > com.sun.el:el-ri:1.0 (+
> >>  > >>> META-INF/javax.el.
> >>  > >>>>  ExpressionFactory
> >>  > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my
> > expression can be
> >>  > >>> evaluated
> >>  > >>>>  > but I can't use any new feature of 3.0
> > (like lambdas)
> >>  > >>>>  >
> >>  > >>>>  > So, either my dependencies are wrong or I am
> > not correctly
> >>  > >>> initializing
> >>  > >>>>  my
> >>  > >>>>  > factory.
> >>  > >>>>  >
> >>  > >>>>  > Does anybody have an idea?
> >>  > >>>>  >
> >>  > >>>>  > Thanks,
> >>  > >>>>  >
> >>  > >>>>  > Xavier
> >>  > >>>>
> >>  > >>>>
> >>  > >>>
> >>  > >>
> >>  > >
> >>  > >
> >>  > >
> >>  >
> >>  >
> >>
> >>
> >
>
>
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-09-29 8:32 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> @Mark
>
> thanks, it works when adding any other qualifier!
>
> btw, do you think it would hurt to qualify the built-in conversation bean
> with @Named("javax.enterprise.context.conversation") in OWB? That way I
> could inject the built-in with @Inject @Named("javax.enteprise.context.conversation")
> and expose it via @Produces @Named("conversation") without resorting to
> some extra qualifier.
>
> @Romain
>
> I was wondering where exactly is your hacky el resolver implemented? If
> the "javax.enterprise.context.conversation" name is a requirement coming
> from the CDI spec, then I would suppose it is implemented in OWB (in the
> resolver you get from the BeanManager) but as my tests with OEJB+OWB fail,
> I suppose it is not there (or not enabled in some way). On the contrary, if
> the requirement comes from the java EE spec, then I suppose it is
> implemented in TomEE and that would explain why my tests fail.
>
>
The name is built it in openwebbeans:
https://github.com/apache/openwebbeans/blob/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java#L54

The spec states:

"The container provides a built-in bean with bean type Conversation, scope
@RequestScoped, and qualifier@Default, named
javax.enterprise.context.conversation."

So no qualifier @Named but a Bean<?> name (no comment ;))


> Xavier
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Thursday, September 29, 2016 12:12 AM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> @Default is always assumed when you don't add a specific Qualifier other
> than @Named and @Any.
>
> Xavier, can you please add any random qualifier? E.g. @Destroyed.
>
> This will stop CDI from complaining but EL should work.
>
> LieGrue,
> strub
>
>
>
>
>
> > On Thursday, 29 September 2016, 0:04, Xavier Dury <ka...@hotmail.com>
> wrote:
> > > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
>
>
>
> OpenEjbElTest.java
> gist.github.com
> property=
> >
> >
> >
> > From: Xavier Dury <ka...@hotmail.com>
> > Sent: Wednesday, September 28, 2016 11:54 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > No, I didn't add the @Default to the @Produces method.
> >
> > I verified:
> >
> > @RequestScoped
> > public class ConversationWrapper {
> >
> >         private @Inject Conversation conv;
> >
> >         @Produces
> >         @Dependent
> >         @Named("conv")
> >         public Conversation getConv() {
> >                 return conv;
> >         }
> > }
> >
> > result:
> >
> > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> is more
> > than one Bean with type javax.enterprise.context.ConversationQualifiers:
> > [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :  conv, Bean Owner
> :
> > [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> > Types:[java.lang.Object,eg.ConversationWrapper],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> > found beans:
> > ConversationImpl, WebBeansType:CONVERSATION,
> > Name:javax.enterprise.context.conversation, API
> > Types:[java.lang.Object,org.apache.webbeans.conversation.
> ConversationImpl,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from
> > jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named]
> > from
> > file:/D:/development/workspaces/openejb-el/target/test-classes/eg/
> ConversationWrapper.class
> >
> >
> >
> >
> > From: Romain Manni-Bucau <rm...@gmail.com>
> > Sent: Wednesday, September 28, 2016 11:47 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> > Types:[java.lang.Object,javax.enterprise.context.Conversation],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >
> > Why is there @Default there? producer should only have the @Named you set
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >
> >
> > RBlog: the RManniBucau v2 Blog
> > blog-rmannibucau.rhcloud.com
> > RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source,
> > Code and geeky topics...
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> |
> >
> >
> > [old blog] new RManniBucau().blog()
> > rmannibucau.wordpress.com
> > New blog on: https://blog-rmannibucau.rhcloud.com/
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  It seems that to inject the conversation in
> > ConversationWrapper.conversation,
> >>  OWB does consider both the build-in conversation bean and the produced
> one
> >>  from... ConversationWrapper.getConv().
> >>
> >>  I tried something like that:
> >>
> >>  @RequestScoped
> >>  public class ConversationWrapper {
> >>
> >>          private @Inject
> > @Named("javax.enterprise.context.conversation")
> >>  Conversation conv;
> >>
> >>          @Produces
> >>          @Dependent
> >>          @Named("conv")
> >>          public Conversation getConv() {
> >>                  return conv;
> >>          }
> >>  }
> >>
> >>  But it gives the following error:
> >>
> >>  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> >>  type [javax.enterprise.context.Conversation] is not found with the
> >>  qualifiers
> >>  Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> >>  conversation)]
> >>  for injection into Field Injection Point, field name :  conv, Bean
> Owner :
> >>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> >>  Types:[eg.ConversationWrapper,java.lang.Object],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> >>
> >>
> >>
> >>
> >>  From: Xavier Dury <ka...@hotmail.com>
> >>  Sent: Wednesday, September 28, 2016 11:34 PM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  Got the same result with 'conv':
> >>
> >>  Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> There is
> >>  more than one Bean with type
> > javax.enterprise.context.ConversationQualifiers:
> >>  [@javax.enterprise.inject.Default()]
> >>  for injection into Field Injection Point, field name :  conversation,
> Bean
> >>  Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> >>  Types:[java.lang.Object,eg.ConversationAliaser],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> >>  found beans:
> >>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> >>  Types:[java.lang.Object,javax.enterprise.context.Conversation],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> >>  workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> >>  ConversationImpl, WebBeansType:CONVERSATION,
> > Name:javax.enterprise.context.conversation,
> >>  API Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  javax.enterprise.context.Conversation,java.lang.Object],
> >>  Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]
> >>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Wednesday, September 28, 2016 11:29 PM
> >>  To: users@tomee.apache.org
> >>  Cc: Mark Struberg
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  missing @Named("conv")?
> >>
> >>
> >>  Romain Manni-Bucau
> >>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>
> >>
> >>
> >>  Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  twitter.com
> >>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>  https://t.co/0VnvWwbedt . Blog ...
> >>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> >>
> >>
> >>  RBlog: the RManniBucau v2 Blog
> >>  blog-rmannibucau.rhcloud.com
> >>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> >>  Source, Code and geeky topics...
> >>  <http://rmannibucau.wordpress.com> | Github <https://github.com/
> >>  rmannibucau> |
> >>
> >>
> >>  [old blog] new RManniBucau().blog()
> >>  rmannibucau.wordpress.com
> >>  New blog on: https://blog-rmannibucau.rhcloud.com/
> >>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >>  <http://www.tomitribe.com> | JavaEE Factory
> >>  <https://javaeefactory-rmannibucau.rhcloud.com>
> >>
> >>  2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>
> >>  >
> >>  > Caused by: javax.enterprise.inject.AmbiguousResolutionException:
> There
> >>  is
> >>  > more than one Bean with type javax.enterprise.context.
> >>  ConversationQualifiers:
> >>  > [@javax.enterprise.inject.Default()]
> >>  > for injection into Field Injection Point, field name :  conversation,
> >>  Bean
> >>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> >>  > Types:[eg.ConversationAliaser,java.lang.Object],
> >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  enterprise.inject.Any]]
> >>  > found beans:
> >>  > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> >>  > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> >>  > Qualifiers:[javax.enterprise.inject.Default,javax.
> >>  > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> >>  > workspaces/openejb-el/target/test-classes/eg/
> ConversationWrapper.class
> >>  > ConversationImpl, WebBeansType:CONVERSATION,
> >>  Name:javax.enterprise.context.conversation,
> >>  > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> >>  > javax.enterprise.context.Conversation,java.lang.Object],
> >>  >
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> >>  > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> >>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> >>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > From: Mark Struberg <st...@yahoo.de.INVALID>
> >>  > Sent: Wednesday, September 28, 2016 11:20 PM
> >>  > To: users@tomee.apache.org
> >>  > Subject: Re: OpenEJB and EL
> >>  >
> >>  > +1
> >>  >
> >>  > means
> >>  >
> >>  > @RequestScoped
> >>  >
> >>  > public class ConversationWrapper {
> >>  >   private @Inject Conversation conv;
> >>  >
> >>  >   @Produces
> >>  >   @Dependent
> >>  >   @Named("conv")
> >>  >
> >>  >   public Conversation getConv() {
> >>  >     return conv;
> >>  >   }
> >>  > }
> >>  >
> >>  >
> >>  >
> >>  >
> >>  > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> >>  > rmannibucau@gmail.com> wrote:
> >>  >
> >>  >
> >>  > >
> >>  > >
> >>  > >a producer allows to get a shorter/more elegant naming like
> > #{conv.id}
> >>  > if you @Produces @Named("conv") ;)
> >>  > >
> >>  > >
> >>  > >
> >>  > >Romain Manni-Bucau
> >>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> >>  > Tomitriber | JavaEE Factory
> >>  > >
> >>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg
> > <st...@yahoo.de.invalid>:
> >>  > >
> >>  > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> >>  > >>
> >>  > >>Problem is that the EE umbrella spec, the EL spec and the CDI
> > spec
> >>  > contradict each other.
> >>  > >>
> >>  > >>The Weld guys solved this by introducing a Javax class. But
> > that takes
> >>  > away the whole javax.* tree for the EL. That's just not good as it
> >>  > contradicts the EL spec.
> >>  > >>
> >>  > >>Could you please try the following
> >>  > >>
> >>  > >>@RequestScoped
> >>  > >>@Named("conversation")
> >>  > >>public class ConversationWrapper {
> >>  > >>   private @Inject Conversation conv;
> >>  > >>
> >>  > >>  public Conversation get() {
> >>  > >>       return conv;
> >>  > >>   }
> >>  > >>}
> >>  > >>
> >>  > >>And in the EL just use #{conversation.get.id}
> >>  > >>
> >>  > >>LieGrue,
> >>  > >>strub
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>
> >>  > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> >>  > kalgon@hotmail.com> wrote:
> >>  > >>> > I really don't understand how something like
> > <f:param
> >>  > >>> name="cid"
> >>  > >>> value="#{javax.enterprise.
> > context.conversation.id}"/> actually
> >>  > >>> works... something must be made to make the EL processor
> > accept that
> >>  > invalid
> >>  > >>> bean name.
> >>  > >>>
> >>  > >>> Making a producer which @Produces @Named Conversation
> > conflicts with
> >>  > the
> >>  > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >>  > >>>
> >>  > >>> ... so, I have done the following for my tests but I feel
> > a bit
> >>  > ashamed because
> >>  > >>> I can't imagine there is no better solution than this
> > ;-)
> >>  > >>>
> >>  > >>> public class ConversationAliaser {
> >>  > >>>     public class Javax {
> >>  > >>>         public Enterprise getEnterprise() {return
> > new Enterprise();}
> >>  > >>>
> >>  > >>>     }
> >>  > >>>     public class Enterprise {
> >>  > >>>         public Context getContext() {return new
> > Context();}
> >>  > >>>     }
> >>  > >>>     public class Context {
> >>  > >>>         public Conversation getConversation()
> > {return conversation;}
> >>  > >>>
> >>  > >>>     }
> >>  > >>>     @Inject
> >>  > >>>     private Conversation conversation;
> >>  > >>>     @Produces @ApplicationScoped
> > @Named("javax")
> >>  > >>>     public Javax javax() {return new Javax();}
> >>  > >>> }
> >>  > >>>
> >>  > >>> But that works!
> >>  > >>>
> >>  > >>> Xavier
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> From: Xavier Dury <ka...@hotmail.com>
> >>  > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> >>  > >>> To: users@tomee.apache.org
> >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>>
> >>  > >>> Hmmm... I guess I'll have to @Produces @Named the
> > conversation if I
> >>  > want to
> >>  > >>> use it in ELs. I don't know if something like
> >>  > >>> #{applicationScope['javax. enterprise.context.
> >>  > conversation'].transient}
> >>  > >>> would work?
> >>  > >>>
> >>  > >>> I remember back in my JSP days that, sometimes, I had to
> > use
> >>  something
> >>  > like
> >>  > >>> ${requestScope['javax.servlet.
> > forward.request_uri']} instead of
> >>  > >>> plain ${javax.servlet.forward. request_uri}.
> >>  > >>>
> >>  > >>> Xavier
> >>  > >>>
> >>  > >>>
> >>  > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> >>  > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> >>  > >>> To: users@tomee.apache.org
> >>  > >>> Subject: Re: OpenEJB and EL
> >>  > >>>
> >>  > >>> hmm, wonder if it is linked to the value you try to
> > evaluate (which
> >>  > doesn't
> >>  > >>> respect EL spec even if in CDI spec - don't ask
> > please ;)).. See
> >>  > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> >>  >
> >>  >
> >>  > System Dashboard - JBoss Issue Tracker
> >>  > issues.jboss.org
> >>  > Atlassian JIRA Project Management Software
> > (v6.4.11#64026-sha1:78f6ec4)
> >>  > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> >>  source
> >>  > license for Red Hat ...
> >>  > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015-
> > January/006009.html
> >>  >
> >>  >
> >>  > lists.jboss.org Mailing Lists
> >>  > lists.jboss.org
> >>  > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all
> the
> >>  > public mailing lists on lists.jboss.org. Click on a list name to get
> >>  more
> >>  > information ...
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> Romain Manni-Bucau
> >>  > >>> @rmannibucau <https://twitter.com/ rmannibucau> |
> > Blog
> >>  > >>>
> >>  > >>>
> >>  > >>>
> >>  > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> >>  > >>> twitter.com
> >>  > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau).
> > ASF /
> >>  > Java(EE) /
> >>  > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE
> > Factory:
> >>  > >>> https://t.co/0VnvWwbedt . Blog ...
> >>  > >>> <https://blog-rmannibucau. rhcloud.com> | Old
> > Wordpress Blog
> >>  > >>> <http://rmannibucau.wordpress. com> | Github
> >>  > >>> <https://github.com/ rmannibucau> |
> >>  > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau>
> > | Tomitriber
> >>  > >>> <http://www.tomitribe.com> | JavaEE Factory
> >>  > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> >>  > >>>
> >>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury
> > <ka...@hotmail.com>:
> >>  > >>>
> >>  > >>>>  Hi Romain,
> >>  > >>>>
> >>  > >>>>  I tried with org.apache.tomcat:tomcat-
> > jasper-el:8.5.5 but it does
> >>  > not
> >>  > >>>>  parse my expression until I change
> > ".transient" by
> >>  > >>> ".isTransient()" and
> >>  > >>>>  then it gives the same error: javax.el.
> > PropertyNotFoundException:
> >>  > >>>>  ELResolver cannot handle a null base Object with
> > identifier
> >>  > >>> 'javax'.
> >>  > >>>>
> >>  > >>>>  Does the EL context need something else than adding
> > the
> >>  > >>>>  BeanManager.getELResolver()  to be able to resolve
> > some implicit
> >>  > objects? I
> >>  > >>>>  don't understand why it works with ri-1.0.
> >>  > >>>>
> >>  > >>>>  Xavier
> >>  > >>>>
> >>  > >>>>
> >>  > >>>>  From: Romain Manni-Bucau
> > <rm...@gmail.com>
> >>  > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>  > >>>>  To: users@tomee.apache.org
> >>  > >>>>  Subject: Re: OpenEJB and EL
> >>  > >>>>
> >>  > >>>>  Hi Xavier
> >>  > >>>>
> >>  > >>>>  On the phone so hard to give you a link bit try
> > using tomcat el
> >>  impl
> >>  > of
> >>  > >>>>  tomcat 8.5
> >>  > >>>>
> >>  > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury"
> > <ka...@hotmail.com>
> >>  > >>> a écrit :
> >>  > >>>>
> >>  > >>>>  > Hi,
> >>  > >>>>  >
> >>  > >>>>  > I am using OpenEJB for my tests and need
> > support for EL
> >>  > expressions in
> >>  > >>> my
> >>  > >>>>  > own code.
> >>  > >>>>  >
> >>  > >>>>  > By default, if I do something like this (pay
> > attention to the
> >>  > >>>>  expression):
> >>  > >>>>  >
> >>  > >>>>  > ExpressionFactory factory = beanManager.
> > wrapExpressionFactory(
> >>  > >>>>  > ExpressionFactory.newInstance( ));
> >>  > >>>>  > StandardELContext elContext = new
> > StandardELContext(factory);
> >>  > >>>>  > elContext.addELResolver(
> > beanManager.getELResolver());
> >>  > >>>>  > ValueExpression expression =
> > factory.createValueExpression(
> >>  > elContext,
> >>  > >>>>  > "#{javax.enterprise.context.
> > conversation.transient}",
> >>  > >>> Boolean.class);
> >>  > >>>>  > expression.getValue(elContext) ;
> >>  > >>>>  >
> >>  > >>>>  > and only add org.apache.tomee:openejb-core:
> > 7.0.1 to my project
> >>  > then I
> >>  > >>>>  get
> >>  > >>>>  > javax.el.ELException: Unable to find
> > ExpressionFactory of type:
> >>  > >>>>  > org.apache.el. ExpressionFactoryImpl
> >>  > >>>>  >
> >>  > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I
> > get javax.el.
> >>  > >>>>  PropertyNotFoundException:
> >>  > >>>>  > ELResolver cannot handle a null base Object
> > with identifier
> >>  > >>> 'javax'
> >>  > >>>>  >
> >>  > >>>>  > if I switch the EL library to
> > com.sun.el:el-ri:1.0 (+
> >>  > >>> META-INF/javax.el.
> >>  > >>>>  ExpressionFactory
> >>  > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my
> > expression can be
> >>  > >>> evaluated
> >>  > >>>>  > but I can't use any new feature of 3.0
> > (like lambdas)
> >>  > >>>>  >
> >>  > >>>>  > So, either my dependencies are wrong or I am
> > not correctly
> >>  > >>> initializing
> >>  > >>>>  my
> >>  > >>>>  > factory.
> >>  > >>>>  >
> >>  > >>>>  > Does anybody have an idea?
> >>  > >>>>  >
> >>  > >>>>  > Thanks,
> >>  > >>>>  >
> >>  > >>>>  > Xavier
> >>  > >>>>
> >>  > >>>>
> >>  > >>>
> >>  > >>
> >>  > >
> >>  > >
> >>  > >
> >>  >
> >>  >
> >>
> >>
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
@Mark

thanks, it works when adding any other qualifier!

btw, do you think it would hurt to qualify the built-in conversation bean with @Named("javax.enterprise.context.conversation") in OWB? That way I could inject the built-in with @Inject @Named("javax.enteprise.context.conversation") and expose it via @Produces @Named("conversation") without resorting to some extra qualifier.

@Romain

I was wondering where exactly is your hacky el resolver implemented? If the "javax.enterprise.context.conversation" name is a requirement coming from the CDI spec, then I would suppose it is implemented in OWB (in the resolver you get from the BeanManager) but as my tests with OEJB+OWB fail, I suppose it is not there (or not enabled in some way). On the contrary, if the requirement comes from the java EE spec, then I suppose it is implemented in TomEE and that would explain why my tests fail.

Xavier




From: Mark Struberg <st...@yahoo.de.INVALID>
Sent: Thursday, September 29, 2016 12:12 AM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
@Default is always assumed when you don't add a specific Qualifier other than @Named and @Any.

Xavier, can you please add any random qualifier? E.g. @Destroyed.

This will stop CDI from complaining but EL should work.

LieGrue,
strub





> On Thursday, 29 September 2016, 0:04, Xavier Dury <ka...@hotmail.com> wrote:
> > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf



OpenEjbElTest.java
gist.github.com
property=
> 
> 
> 
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 11:54 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>    
> No, I didn't add the @Default to the @Produces method.
> 
> I verified:
> 
> @RequestScoped
> public class ConversationWrapper {
>         
>         private @Inject Conversation conv;
> 
>         @Produces
>         @Dependent
>         @Named("conv")
>         public Conversation getConv() {
>                 return conv;
>         }
> }
> 
> result:
> 
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more 
> than one Bean with type javax.enterprise.context.ConversationQualifiers: 
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conv, Bean Owner : 
> [ConversationWrapper, WebBeansType:MANAGED, Name:null, API 
> Types:[java.lang.Object,eg.ConversationWrapper], 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans: 
> ConversationImpl, WebBeansType:CONVERSATION, 
> Name:javax.enterprise.context.conversation, API 
> Types:[java.lang.Object,org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]  from 
> jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API 
> Types:[java.lang.Object,javax.enterprise.context.Conversation], 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named]
> from 
> file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> 
> 
> 
> 
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:47 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>     
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> 
> Why is there @Default there? producer should only have the @Named you set
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: 
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> 
> 
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source,
> Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> |
> 
> 
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>>  It seems that to inject the conversation in 
> ConversationWrapper.conversation,
>>  OWB does consider both the build-in conversation bean and the produced one
>>  from... ConversationWrapper.getConv().
>> 
>>  I tried something like that:
>> 
>>  @RequestScoped
>>  public class ConversationWrapper {
>> 
>>          private @Inject 
> @Named("javax.enterprise.context.conversation")
>>  Conversation conv;
>> 
>>          @Produces
>>          @Dependent
>>          @Named("conv")
>>          public Conversation getConv() {
>>                  return conv;
>>          }
>>  }
>> 
>>  But it gives the following error:
>> 
>>  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
>>  type [javax.enterprise.context.Conversation] is not found with the
>>  qualifiers
>>  Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
>>  conversation)]
>>  for injection into Field Injection Point, field name :  conv, Bean Owner :
>>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  Types:[eg.ConversationWrapper,java.lang.Object],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>> 
>> 
>> 
>> 
>>  From: Xavier Dury <ka...@hotmail.com>
>>  Sent: Wednesday, September 28, 2016 11:34 PM
>>  To: users@tomee.apache.org
>>  Subject: Re: OpenEJB and EL
>> 
>>  Got the same result with 'conv':
>> 
>>  Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
>>  more than one Bean with type 
> javax.enterprise.context.ConversationQualifiers:
>>  [@javax.enterprise.inject.Default()]
>>  for injection into Field Injection Point, field name :  conversation, Bean
>>  Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
>>  Types:[java.lang.Object,eg.ConversationAliaser],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>>  found beans:
>>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
>>  workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  ConversationImpl, WebBeansType:CONVERSATION, 
> Name:javax.enterprise.context.conversation,
>>  API Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  javax.enterprise.context.Conversation,java.lang.Object],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
>>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  Sent: Wednesday, September 28, 2016 11:29 PM
>>  To: users@tomee.apache.org
>>  Cc: Mark Struberg
>>  Subject: Re: OpenEJB and EL
>> 
>>  missing @Named("conv")?
>> 
>> 
>>  Romain Manni-Bucau
>>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>> 
>> 
>>  RBlog: the RManniBucau v2 Blog
>>  blog-rmannibucau.rhcloud.com
>>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
>>  Source, Code and geeky topics...
>>  <http://rmannibucau.wordpress.com> | Github <https://github.com/
>>  rmannibucau> |
>> 
>> 
>>  [old blog] new RManniBucau().blog()
>>  rmannibucau.wordpress.com
>>  New blog on: https://blog-rmannibucau.rhcloud.com/
>>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>  <http://www.tomitribe.com> | JavaEE Factory
>>  <https://javaeefactory-rmannibucau.rhcloud.com>
>> 
>>  2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>> 
>>  >
>>  > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
>>  is
>>  > more than one Bean with type javax.enterprise.context.
>>  ConversationQualifiers:
>>  > [@javax.enterprise.inject.Default()]
>>  > for injection into Field Injection Point, field name :  conversation,
>>  Bean
>>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
>>  > Types:[eg.ConversationAliaser,java.lang.Object],
>>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]]
>>  > found beans:
>>  > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
>>  > Types:[javax.enterprise.context.Conversation,java.lang.Object],
>>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
>>  > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  > ConversationImpl, WebBeansType:CONVERSATION,
>>  Name:javax.enterprise.context.conversation,
>>  > API Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > javax.enterprise.context.Conversation,java.lang.Object],
>>  > 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
>>  > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > Sent: Wednesday, September 28, 2016 11:20 PM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > +1
>>  >
>>  > means
>>  >
>>  > @RequestScoped
>>  >
>>  > public class ConversationWrapper {
>>  >   private @Inject Conversation conv;
>>  >
>>  >   @Produces
>>  >   @Dependent
>>  >   @Named("conv")
>>  >
>>  >   public Conversation getConv() {
>>  >     return conv;
>>  >   }
>>  > }
>>  >
>>  >
>>  >
>>  >
>>  > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
>>  > rmannibucau@gmail.com> wrote:
>>  >
>>  >
>>  > >
>>  > >
>>  > >a producer allows to get a shorter/more elegant naming like 
> #{conv.id}
>>  > if you @Produces @Named("conv") ;)
>>  > >
>>  > >
>>  > >
>>  > >Romain Manni-Bucau
>>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
>>  > Tomitriber | JavaEE Factory
>>  > >
>>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg 
> <st...@yahoo.de.invalid>:
>>  > >
>>  > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>>  > >>
>>  > >>Problem is that the EE umbrella spec, the EL spec and the CDI 
> spec
>>  > contradict each other.
>>  > >>
>>  > >>The Weld guys solved this by introducing a Javax class. But 
> that takes
>>  > away the whole javax.* tree for the EL. That's just not good as it
>>  > contradicts the EL spec.
>>  > >>
>>  > >>Could you please try the following
>>  > >>
>>  > >>@RequestScoped
>>  > >>@Named("conversation")
>>  > >>public class ConversationWrapper {
>>  > >>   private @Inject Conversation conv;
>>  > >>
>>  > >>  public Conversation get() {
>>  > >>       return conv;
>>  > >>   }
>>  > >>}
>>  > >>
>>  > >>And in the EL just use #{conversation.get.id}
>>  > >>
>>  > >>LieGrue,
>>  > >>strub
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
>>  > kalgon@hotmail.com> wrote:
>>  > >>> > I really don't understand how something like 
> <f:param
>>  > >>> name="cid"
>>  > >>> value="#{javax.enterprise. 
> context.conversation.id}"/> actually
>>  > >>> works... something must be made to make the EL processor 
> accept that
>>  > invalid
>>  > >>> bean name.
>>  > >>>
>>  > >>> Making a producer which @Produces @Named Conversation 
> conflicts with
>>  > the
>>  > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
>>  > >>>
>>  > >>> ... so, I have done the following for my tests but I feel 
> a bit
>>  > ashamed because
>>  > >>> I can't imagine there is no better solution than this 
> ;-)
>>  > >>>
>>  > >>> public class ConversationAliaser {
>>  > >>>     public class Javax {
>>  > >>>         public Enterprise getEnterprise() {return 
> new Enterprise();}
>>  > >>>
>>  > >>>     }
>>  > >>>     public class Enterprise {
>>  > >>>         public Context getContext() {return new 
> Context();}
>>  > >>>     }
>>  > >>>     public class Context {
>>  > >>>         public Conversation getConversation() 
> {return conversation;}
>>  > >>>
>>  > >>>     }
>>  > >>>     @Inject
>>  > >>>     private Conversation conversation;
>>  > >>>     @Produces @ApplicationScoped 
> @Named("javax")
>>  > >>>     public Javax javax() {return new Javax();}
>>  > >>> }
>>  > >>>
>>  > >>> But that works!
>>  > >>>
>>  > >>> Xavier
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> From: Xavier Dury <ka...@hotmail.com>
>>  > >>> Sent: Wednesday, September 28, 2016 8:42 PM
>>  > >>> To: users@tomee.apache.org
>>  > >>> Subject: Re: OpenEJB and EL
>>  > >>>
>>  > >>> Hmmm... I guess I'll have to @Produces @Named the 
> conversation if I
>>  > want to
>>  > >>> use it in ELs. I don't know if something like
>>  > >>> #{applicationScope['javax. enterprise.context.
>>  > conversation'].transient}
>>  > >>> would work?
>>  > >>>
>>  > >>> I remember back in my JSP days that, sometimes, I had to 
> use
>>  something
>>  > like
>>  > >>> ${requestScope['javax.servlet. 
> forward.request_uri']} instead of
>>  > >>> plain ${javax.servlet.forward. request_uri}.
>>  > >>>
>>  > >>> Xavier
>>  > >>>
>>  > >>>
>>  > >>> From: Romain Manni-Bucau <rm...@gmail.com>
>>  > >>> Sent: Wednesday, September 28, 2016 6:54 PM
>>  > >>> To: users@tomee.apache.org
>>  > >>> Subject: Re: OpenEJB and EL
>>  > >>>
>>  > >>> hmm, wonder if it is linked to the value you try to 
> evaluate (which
>>  > doesn't
>>  > >>> respect EL spec even if in CDI spec - don't ask 
> please ;)).. See
>>  > >>> https://issues.jboss.org/ browse/CDITCK-462 /
>>  >
>>  >
>>  > System Dashboard - JBoss Issue Tracker
>>  > issues.jboss.org
>>  > Atlassian JIRA Project Management Software 
> (v6.4.11#64026-sha1:78f6ec4)
>>  > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
>>  source
>>  > license for Red Hat ...
>>  > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015-
> January/006009.html
>>  >
>>  >
>>  > lists.jboss.org Mailing Lists
>>  > lists.jboss.org
>>  > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
>>  > public mailing lists on lists.jboss.org. Click on a list name to get
>>  more
>>  > information ...
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> Romain Manni-Bucau
>>  > >>> @rmannibucau <https://twitter.com/ rmannibucau> |  
> Blog
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>> twitter.com
>>  > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE
> Factory:
>>  > >>> https://t.co/0VnvWwbedt . Blog ...
>>  > >>> <https://blog-rmannibucau. rhcloud.com> | Old 
> Wordpress Blog
>>  > >>> <http://rmannibucau.wordpress. com> | Github
>>  > >>> <https://github.com/ rmannibucau> |
>>  > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> 
> | Tomitriber
>>  > >>> <http://www.tomitribe.com> | JavaEE Factory
>>  > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
>>  > >>>
>>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >>>
>>  > >>>>  Hi Romain,
>>  > >>>>
>>  > >>>>  I tried with org.apache.tomcat:tomcat- 
> jasper-el:8.5.5 but it does
>>  > not
>>  > >>>>  parse my expression until I change 
> ".transient" by
>>  > >>> ".isTransient()" and
>>  > >>>>  then it gives the same error: javax.el. 
> PropertyNotFoundException:
>>  > >>>>  ELResolver cannot handle a null base Object with 
> identifier
>>  > >>> 'javax'.
>>  > >>>>
>>  > >>>>  Does the EL context need something else than adding 
> the
>>  > >>>>  BeanManager.getELResolver()  to be able to resolve 
> some implicit
>>  > objects? I
>>  > >>>>  don't understand why it works with ri-1.0.
>>  > >>>>
>>  > >>>>  Xavier
>>  > >>>>
>>  > >>>>
>>  > >>>>  From: Romain Manni-Bucau 
> <rm...@gmail.com>
>>  > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
>>  > >>>>  To: users@tomee.apache.org
>>  > >>>>  Subject: Re: OpenEJB and EL
>>  > >>>>
>>  > >>>>  Hi Xavier
>>  > >>>>
>>  > >>>>  On the phone so hard to give you a link bit try 
> using tomcat el
>>  impl
>>  > of
>>  > >>>>  tomcat 8.5
>>  > >>>>
>>  > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" 
> <ka...@hotmail.com>
>>  > >>> a écrit :
>>  > >>>>
>>  > >>>>  > Hi,
>>  > >>>>  >
>>  > >>>>  > I am using OpenEJB for my tests and need 
> support for EL
>>  > expressions in
>>  > >>> my
>>  > >>>>  > own code.
>>  > >>>>  >
>>  > >>>>  > By default, if I do something like this (pay 
> attention to the
>>  > >>>>  expression):
>>  > >>>>  >
>>  > >>>>  > ExpressionFactory factory = beanManager. 
> wrapExpressionFactory(
>>  > >>>>  > ExpressionFactory.newInstance( ));
>>  > >>>>  > StandardELContext elContext = new 
> StandardELContext(factory);
>>  > >>>>  > elContext.addELResolver( 
> beanManager.getELResolver());
>>  > >>>>  > ValueExpression expression = 
> factory.createValueExpression(
>>  > elContext,
>>  > >>>>  > "#{javax.enterprise.context. 
> conversation.transient}",
>>  > >>> Boolean.class);
>>  > >>>>  > expression.getValue(elContext) ;
>>  > >>>>  >
>>  > >>>>  > and only add org.apache.tomee:openejb-core: 
> 7.0.1 to my project
>>  > then I
>>  > >>>>  get
>>  > >>>>  > javax.el.ELException: Unable to find 
> ExpressionFactory of type:
>>  > >>>>  > org.apache.el. ExpressionFactoryImpl
>>  > >>>>  >
>>  > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I 
> get javax.el.
>>  > >>>>  PropertyNotFoundException:
>>  > >>>>  > ELResolver cannot handle a null base Object 
> with identifier
>>  > >>> 'javax'
>>  > >>>>  >
>>  > >>>>  > if I switch the EL library to 
> com.sun.el:el-ri:1.0 (+
>>  > >>> META-INF/javax.el.
>>  > >>>>  ExpressionFactory
>>  > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my 
> expression can be
>>  > >>> evaluated
>>  > >>>>  > but I can't use any new feature of 3.0 
> (like lambdas)
>>  > >>>>  >
>>  > >>>>  > So, either my dependencies are wrong or I am 
> not correctly
>>  > >>> initializing
>>  > >>>>  my
>>  > >>>>  > factory.
>>  > >>>>  >
>>  > >>>>  > Does anybody have an idea?
>>  > >>>>  >
>>  > >>>>  > Thanks,
>>  > >>>>  >
>>  > >>>>  > Xavier
>>  > >>>>
>>  > >>>>
>>  > >>>
>>  > >>
>>  > >
>>  > >
>>  > >
>>  >
>>  >
>> 
>> 
> 
    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
@Default is always assumed when you don't add a specific Qualifier other than @Named and @Any.

Xavier, can you please add any random qualifier? E.g. @Destroyed.

This will stop CDI from complaining but EL should work.

LieGrue,
strub





> On Thursday, 29 September 2016, 0:04, Xavier Dury <ka...@hotmail.com> wrote:
> > https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf
> 
> 
> 
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 11:54 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>    
> No, I didn't add the @Default to the @Produces method.
> 
> I verified:
> 
> @RequestScoped
> public class ConversationWrapper {
>         
>         private @Inject Conversation conv;
> 
>         @Produces
>         @Dependent
>         @Named("conv")
>         public Conversation getConv() {
>                 return conv;
>         }
> }
> 
> result:
> 
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more 
> than one Bean with type javax.enterprise.context.ConversationQualifiers: 
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conv, Bean Owner : 
> [ConversationWrapper, WebBeansType:MANAGED, Name:null, API 
> Types:[java.lang.Object,eg.ConversationWrapper], 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans: 
> ConversationImpl, WebBeansType:CONVERSATION, 
> Name:javax.enterprise.context.conversation, API 
> Types:[java.lang.Object,org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation], 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]  from 
> jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API 
> Types:[java.lang.Object,javax.enterprise.context.Conversation], 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] 
> from 
> file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> 
> 
> 
> 
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:47 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>     
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> 
> Why is there @Default there? producer should only have the @Named you set
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: 
> https://t.co/0VnvWwbedt . Blog ...
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> 
> 
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, 
> Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github 
> <https://github.com/rmannibucau> |
> 
> 
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>>  It seems that to inject the conversation in 
> ConversationWrapper.conversation,
>>  OWB does consider both the build-in conversation bean and the produced one
>>  from... ConversationWrapper.getConv().
>> 
>>  I tried something like that:
>> 
>>  @RequestScoped
>>  public class ConversationWrapper {
>> 
>>          private @Inject 
> @Named("javax.enterprise.context.conversation")
>>  Conversation conv;
>> 
>>          @Produces
>>          @Dependent
>>          @Named("conv")
>>          public Conversation getConv() {
>>                  return conv;
>>          }
>>  }
>> 
>>  But it gives the following error:
>> 
>>  Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
>>  type [javax.enterprise.context.Conversation] is not found with the
>>  qualifiers
>>  Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
>>  conversation)]
>>  for injection into Field Injection Point, field name :  conv, Bean Owner :
>>  [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
>>  Types:[eg.ConversationWrapper,java.lang.Object],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>> 
>> 
>> 
>> 
>>  From: Xavier Dury <ka...@hotmail.com>
>>  Sent: Wednesday, September 28, 2016 11:34 PM
>>  To: users@tomee.apache.org
>>  Subject: Re: OpenEJB and EL
>> 
>>  Got the same result with 'conv':
>> 
>>  Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
>>  more than one Bean with type 
> javax.enterprise.context.ConversationQualifiers:
>>  [@javax.enterprise.inject.Default()]
>>  for injection into Field Injection Point, field name :  conversation, Bean
>>  Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
>>  Types:[java.lang.Object,eg.ConversationAliaser],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>>  found beans:
>>  Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
>>  Types:[java.lang.Object,javax.enterprise.context.Conversation],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
>>  workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  ConversationImpl, WebBeansType:CONVERSATION, 
> Name:javax.enterprise.context.conversation,
>>  API Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  javax.enterprise.context.Conversation,java.lang.Object],
>>  Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
>>  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  Sent: Wednesday, September 28, 2016 11:29 PM
>>  To: users@tomee.apache.org
>>  Cc: Mark Struberg
>>  Subject: Re: OpenEJB and EL
>> 
>>  missing @Named("conv")?
>> 
>> 
>>  Romain Manni-Bucau
>>  @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>> 
>> 
>> 
>>  Romain Manni-Bucau (@rmannibucau) | Twitter
>>  twitter.com
>>  The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>  Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>  https://t.co/0VnvWwbedt . Blog ...
>>  <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>> 
>> 
>>  RBlog: the RManniBucau v2 Blog
>>  blog-rmannibucau.rhcloud.com
>>  RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
>>  Source, Code and geeky topics...
>>  <http://rmannibucau.wordpress.com> | Github <https://github.com/
>>  rmannibucau> |
>> 
>> 
>>  [old blog] new RManniBucau().blog()
>>  rmannibucau.wordpress.com
>>  New blog on: https://blog-rmannibucau.rhcloud.com/
>>  LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>  <http://www.tomitribe.com> | JavaEE Factory
>>  <https://javaeefactory-rmannibucau.rhcloud.com>
>> 
>>  2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>> 
>>  >
>>  > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
>>  is
>>  > more than one Bean with type javax.enterprise.context.
>>  ConversationQualifiers:
>>  > [@javax.enterprise.inject.Default()]
>>  > for injection into Field Injection Point, field name :  conversation,
>>  Bean
>>  > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
>>  > Types:[eg.ConversationAliaser,java.lang.Object],
>>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  enterprise.inject.Any]]
>>  > found beans:
>>  > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
>>  > Types:[javax.enterprise.context.Conversation,java.lang.Object],
>>  > Qualifiers:[javax.enterprise.inject.Default,javax.
>>  > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
>>  > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
>>  > ConversationImpl, WebBeansType:CONVERSATION,
>>  Name:javax.enterprise.context.conversation,
>>  > API Types:[org.apache.webbeans.conversation.ConversationImpl,
>>  > javax.enterprise.context.Conversation,java.lang.Object],
>>  > 
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
>>  > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
>>  > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
>>  > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  > From: Mark Struberg <st...@yahoo.de.INVALID>
>>  > Sent: Wednesday, September 28, 2016 11:20 PM
>>  > To: users@tomee.apache.org
>>  > Subject: Re: OpenEJB and EL
>>  >
>>  > +1
>>  >
>>  > means
>>  >
>>  > @RequestScoped
>>  >
>>  > public class ConversationWrapper {
>>  >   private @Inject Conversation conv;
>>  >
>>  >   @Produces
>>  >   @Dependent
>>  >   @Named("conv")
>>  >
>>  >   public Conversation getConv() {
>>  >     return conv;
>>  >   }
>>  > }
>>  >
>>  >
>>  >
>>  >
>>  > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
>>  > rmannibucau@gmail.com> wrote:
>>  >
>>  >
>>  > >
>>  > >
>>  > >a producer allows to get a shorter/more elegant naming like 
> #{conv.id}
>>  > if you @Produces @Named("conv") ;)
>>  > >
>>  > >
>>  > >
>>  > >Romain Manni-Bucau
>>  > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
>>  > Tomitriber | JavaEE Factory
>>  > >
>>  > >2016-09-28 23:01 GMT+02:00 Mark Struberg 
> <st...@yahoo.de.invalid>:
>>  > >
>>  > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>>  > >>
>>  > >>Problem is that the EE umbrella spec, the EL spec and the CDI 
> spec
>>  > contradict each other.
>>  > >>
>>  > >>The Weld guys solved this by introducing a Javax class. But 
> that takes
>>  > away the whole javax.* tree for the EL. That's just not good as it
>>  > contradicts the EL spec.
>>  > >>
>>  > >>Could you please try the following
>>  > >>
>>  > >>@RequestScoped
>>  > >>@Named("conversation")
>>  > >>public class ConversationWrapper {
>>  > >>   private @Inject Conversation conv;
>>  > >>
>>  > >>  public Conversation get() {
>>  > >>       return conv;
>>  > >>   }
>>  > >>}
>>  > >>
>>  > >>And in the EL just use #{conversation.get.id}
>>  > >>
>>  > >>LieGrue,
>>  > >>strub
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>
>>  > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
>>  > kalgon@hotmail.com> wrote:
>>  > >>> > I really don't understand how something like 
> <f:param
>>  > >>> name="cid"
>>  > >>> value="#{javax.enterprise. 
> context.conversation.id}"/> actually
>>  > >>> works... something must be made to make the EL processor 
> accept that
>>  > invalid
>>  > >>> bean name.
>>  > >>>
>>  > >>> Making a producer which @Produces @Named Conversation 
> conflicts with
>>  > the
>>  > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
>>  > >>>
>>  > >>> ... so, I have done the following for my tests but I feel 
> a bit
>>  > ashamed because
>>  > >>> I can't imagine there is no better solution than this 
> ;-)
>>  > >>>
>>  > >>> public class ConversationAliaser {
>>  > >>>     public class Javax {
>>  > >>>         public Enterprise getEnterprise() {return 
> new Enterprise();}
>>  > >>>
>>  > >>>     }
>>  > >>>     public class Enterprise {
>>  > >>>         public Context getContext() {return new 
> Context();}
>>  > >>>     }
>>  > >>>     public class Context {
>>  > >>>         public Conversation getConversation() 
> {return conversation;}
>>  > >>>
>>  > >>>     }
>>  > >>>     @Inject
>>  > >>>     private Conversation conversation;
>>  > >>>     @Produces @ApplicationScoped 
> @Named("javax")
>>  > >>>     public Javax javax() {return new Javax();}
>>  > >>> }
>>  > >>>
>>  > >>> But that works!
>>  > >>>
>>  > >>> Xavier
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> From: Xavier Dury <ka...@hotmail.com>
>>  > >>> Sent: Wednesday, September 28, 2016 8:42 PM
>>  > >>> To: users@tomee.apache.org
>>  > >>> Subject: Re: OpenEJB and EL
>>  > >>>
>>  > >>> Hmmm... I guess I'll have to @Produces @Named the 
> conversation if I
>>  > want to
>>  > >>> use it in ELs. I don't know if something like
>>  > >>> #{applicationScope['javax. enterprise.context.
>>  > conversation'].transient}
>>  > >>> would work?
>>  > >>>
>>  > >>> I remember back in my JSP days that, sometimes, I had to 
> use
>>  something
>>  > like
>>  > >>> ${requestScope['javax.servlet. 
> forward.request_uri']} instead of
>>  > >>> plain ${javax.servlet.forward. request_uri}.
>>  > >>>
>>  > >>> Xavier
>>  > >>>
>>  > >>>
>>  > >>> From: Romain Manni-Bucau <rm...@gmail.com>
>>  > >>> Sent: Wednesday, September 28, 2016 6:54 PM
>>  > >>> To: users@tomee.apache.org
>>  > >>> Subject: Re: OpenEJB and EL
>>  > >>>
>>  > >>> hmm, wonder if it is linked to the value you try to 
> evaluate (which
>>  > doesn't
>>  > >>> respect EL spec even if in CDI spec - don't ask 
> please ;)).. See
>>  > >>> https://issues.jboss.org/ browse/CDITCK-462 /
>>  >
>>  >
>>  > System Dashboard - JBoss Issue Tracker
>>  > issues.jboss.org
>>  > Atlassian JIRA Project Management Software 
> (v6.4.11#64026-sha1:78f6ec4)
>>  > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
>>  source
>>  > license for Red Hat ...
>>  > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- 
> January/006009.html
>>  >
>>  >
>>  > lists.jboss.org Mailing Lists
>>  > lists.jboss.org
>>  > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
>>  > public mailing lists on lists.jboss.org. Click on a list name to get
>>  more
>>  > information ...
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> Romain Manni-Bucau
>>  > >>> @rmannibucau <https://twitter.com/ rmannibucau> |  
> Blog
>>  > >>>
>>  > >>>
>>  > >>>
>>  > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
>>  > >>> twitter.com
>>  > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). 
> ASF /
>>  > Java(EE) /
>>  > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE 
> Factory:
>>  > >>> https://t.co/0VnvWwbedt . Blog ...
>>  > >>> <https://blog-rmannibucau. rhcloud.com> | Old 
> Wordpress Blog
>>  > >>> <http://rmannibucau.wordpress. com> | Github
>>  > >>> <https://github.com/ rmannibucau> |
>>  > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> 
> | Tomitriber
>>  > >>> <http://www.tomitribe.com> | JavaEE Factory
>>  > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
>>  > >>>
>>  > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury 
> <ka...@hotmail.com>:
>>  > >>>
>>  > >>>>  Hi Romain,
>>  > >>>>
>>  > >>>>  I tried with org.apache.tomcat:tomcat- 
> jasper-el:8.5.5 but it does
>>  > not
>>  > >>>>  parse my expression until I change 
> ".transient" by
>>  > >>> ".isTransient()" and
>>  > >>>>  then it gives the same error: javax.el. 
> PropertyNotFoundException:
>>  > >>>>  ELResolver cannot handle a null base Object with 
> identifier
>>  > >>> 'javax'.
>>  > >>>>
>>  > >>>>  Does the EL context need something else than adding 
> the
>>  > >>>>  BeanManager.getELResolver()  to be able to resolve 
> some implicit
>>  > objects? I
>>  > >>>>  don't understand why it works with ri-1.0.
>>  > >>>>
>>  > >>>>  Xavier
>>  > >>>>
>>  > >>>>
>>  > >>>>  From: Romain Manni-Bucau 
> <rm...@gmail.com>
>>  > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
>>  > >>>>  To: users@tomee.apache.org
>>  > >>>>  Subject: Re: OpenEJB and EL
>>  > >>>>
>>  > >>>>  Hi Xavier
>>  > >>>>
>>  > >>>>  On the phone so hard to give you a link bit try 
> using tomcat el
>>  impl
>>  > of
>>  > >>>>  tomcat 8.5
>>  > >>>>
>>  > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" 
> <ka...@hotmail.com>
>>  > >>> a écrit :
>>  > >>>>
>>  > >>>>  > Hi,
>>  > >>>>  >
>>  > >>>>  > I am using OpenEJB for my tests and need 
> support for EL
>>  > expressions in
>>  > >>> my
>>  > >>>>  > own code.
>>  > >>>>  >
>>  > >>>>  > By default, if I do something like this (pay 
> attention to the
>>  > >>>>  expression):
>>  > >>>>  >
>>  > >>>>  > ExpressionFactory factory = beanManager. 
> wrapExpressionFactory(
>>  > >>>>  > ExpressionFactory.newInstance( ));
>>  > >>>>  > StandardELContext elContext = new 
> StandardELContext(factory);
>>  > >>>>  > elContext.addELResolver( 
> beanManager.getELResolver());
>>  > >>>>  > ValueExpression expression = 
> factory.createValueExpression(
>>  > elContext,
>>  > >>>>  > "#{javax.enterprise.context. 
> conversation.transient}",
>>  > >>> Boolean.class);
>>  > >>>>  > expression.getValue(elContext) ;
>>  > >>>>  >
>>  > >>>>  > and only add org.apache.tomee:openejb-core: 
> 7.0.1 to my project
>>  > then I
>>  > >>>>  get
>>  > >>>>  > javax.el.ELException: Unable to find 
> ExpressionFactory of type:
>>  > >>>>  > org.apache.el. ExpressionFactoryImpl
>>  > >>>>  >
>>  > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I 
> get javax.el.
>>  > >>>>  PropertyNotFoundException:
>>  > >>>>  > ELResolver cannot handle a null base Object 
> with identifier
>>  > >>> 'javax'
>>  > >>>>  >
>>  > >>>>  > if I switch the EL library to 
> com.sun.el:el-ri:1.0 (+
>>  > >>> META-INF/javax.el.
>>  > >>>>  ExpressionFactory
>>  > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my 
> expression can be
>>  > >>> evaluated
>>  > >>>>  > but I can't use any new feature of 3.0 
> (like lambdas)
>>  > >>>>  >
>>  > >>>>  > So, either my dependencies are wrong or I am 
> not correctly
>>  > >>> initializing
>>  > >>>>  my
>>  > >>>>  > factory.
>>  > >>>>  >
>>  > >>>>  > Does anybody have an idea?
>>  > >>>>  >
>>  > >>>>  > Thanks,
>>  > >>>>  >
>>  > >>>>  > Xavier
>>  > >>>>
>>  > >>>>
>>  > >>>
>>  > >>
>>  > >
>>  > >
>>  > >
>>  >
>>  >
>> 
>> 
> 

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
https://gist.github.com/kalgon/fbf529dc9c9764c115433cfb2f0f82bf



From: Xavier Dury <ka...@hotmail.com>
Sent: Wednesday, September 28, 2016 11:54 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
No, I didn't add the @Default to the @Produces method.

I verified:

@RequestScoped
public class ConversationWrapper {
        
        private @Inject Conversation conv;

        @Produces
        @Dependent
        @Named("conv")
        public Conversation getConv() {
                return conv;
        }
}

result:

Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type javax.enterprise.context.ConversationQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  conv, Bean Owner : [ConversationWrapper, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,eg.ConversationWrapper], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation, API Types:[java.lang.Object,org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API Types:[java.lang.Object,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] from file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class




From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 11:47 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
Types:[java.lang.Object,javax.enterprise.context.Conversation],
Qualifiers:[javax.enterprise.inject.Default,javax.
enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class

Why is there @Default there? producer should only have the @Named you set


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> It seems that to inject the conversation in ConversationWrapper.conversation,
> OWB does consider both the build-in conversation bean and the produced one
> from... ConversationWrapper.getConv().
>
> I tried something like that:
>
> @RequestScoped
> public class ConversationWrapper {
>
>         private @Inject @Named("javax.enterprise.context.conversation")
> Conversation conv;
>
>         @Produces
>         @Dependent
>         @Named("conv")
>         public Conversation getConv() {
>                 return conv;
>         }
> }
>
> But it gives the following error:
>
> Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [javax.enterprise.context.Conversation] is not found with the
> qualifiers
> Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> conversation)]
> for injection into Field Injection Point, field name :  conv, Bean Owner :
> [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationWrapper,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 11:34 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Got the same result with 'conv':
>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[java.lang.Object,eg.ConversationAliaser],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:29 PM
> To: users@tomee.apache.org
> Cc: Mark Struberg
> Subject: Re: OpenEJB and EL
>
> missing @Named("conv")?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> >
> > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> is
> > more than one Bean with type javax.enterprise.context.
> ConversationQualifiers:
> > [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :  conversation,
> Bean
> > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> > Types:[eg.ConversationAliaser,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> > found beans:
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> > ConversationImpl, WebBeansType:CONVERSATION,
> Name:javax.enterprise.context.conversation,
> > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> > javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >
> >
> >
> >
> >
> >
> >
> > From: Mark Struberg <st...@yahoo.de.INVALID>
> > Sent: Wednesday, September 28, 2016 11:20 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > +1
> >
> > means
> >
> > @RequestScoped
> >
> > public class ConversationWrapper {
> >   private @Inject Conversation conv;
> >
> >   @Produces
> >   @Dependent
> >   @Named("conv")
> >
> >   public Conversation getConv() {
> >     return conv;
> >   }
> > }
> >
> >
> >
> >
> > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> > rmannibucau@gmail.com> wrote:
> >
> >
> > >
> > >
> > >a producer allows to get a shorter/more elegant naming like #{conv.id}
> > if you @Produces @Named("conv") ;)
> > >
> > >
> > >
> > >Romain Manni-Bucau
> > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> > Tomitriber | JavaEE Factory
> > >
> > >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> > >
> > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> > >>
> > >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> > contradict each other.
> > >>
> > >>The Weld guys solved this by introducing a Javax class. But that takes
> > away the whole javax.* tree for the EL. That's just not good as it
> > contradicts the EL spec.
> > >>
> > >>Could you please try the following
> > >>
> > >>@RequestScoped
> > >>@Named("conversation")
> > >>public class ConversationWrapper {
> > >>   private @Inject Conversation conv;
> > >>
> > >>  public Conversation get() {
> > >>       return conv;
> > >>   }
> > >>}
> > >>
> > >>And in the EL just use #{conversation.get.id}
> > >>
> > >>LieGrue,
> > >>strub
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> > kalgon@hotmail.com> wrote:
> > >>> > I really don't understand how something like <f:param
> > >>> name="cid"
> > >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> > >>> works... something must be made to make the EL processor accept that
> > invalid
> > >>> bean name.
> > >>>
> > >>> Making a producer which @Produces @Named Conversation conflicts with
> > the
> > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> > >>>
> > >>> ... so, I have done the following for my tests but I feel a bit
> > ashamed because
> > >>> I can't imagine there is no better solution than this ;-)
> > >>>
> > >>> public class ConversationAliaser {
> > >>>     public class Javax {
> > >>>         public Enterprise getEnterprise() {return new Enterprise();}
> > >>>
> > >>>     }
> > >>>     public class Enterprise {
> > >>>         public Context getContext() {return new Context();}
> > >>>     }
> > >>>     public class Context {
> > >>>         public Conversation getConversation() {return conversation;}
> > >>>
> > >>>     }
> > >>>     @Inject
> > >>>     private Conversation conversation;
> > >>>     @Produces @ApplicationScoped @Named("javax")
> > >>>     public Javax javax() {return new Javax();}
> > >>> }
> > >>>
> > >>> But that works!
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>>
> > >>> From: Xavier Dury <ka...@hotmail.com>
> > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> > want to
> > >>> use it in ELs. I don't know if something like
> > >>> #{applicationScope['javax. enterprise.context.
> > conversation'].transient}
> > >>> would work?
> > >>>
> > >>> I remember back in my JSP days that, sometimes, I had to use
> something
> > like
> > >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> > >>> plain ${javax.servlet.forward. request_uri}.
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> hmm, wonder if it is linked to the value you try to evaluate (which
> > doesn't
> > >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> >
> >
> > System Dashboard - JBoss Issue Tracker
> > issues.jboss.org
> > Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> source
> > license for Red Hat ...
> > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
> >
> >
> > lists.jboss.org Mailing Lists
> > lists.jboss.org
> > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> > public mailing lists on lists.jboss.org. Click on a list name to get
> more
> > information ...
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau
> > >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>> twitter.com
> > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>> https://t.co/0VnvWwbedt . Blog ...
> > >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> > >>> <http://rmannibucau.wordpress. com> | Github
> > >>> <https://github.com/ rmannibucau> |
> > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> > >>> <http://www.tomitribe.com> | JavaEE Factory
> > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> > >>>
> > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >>>
> > >>>>  Hi Romain,
> > >>>>
> > >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> > not
> > >>>>  parse my expression until I change ".transient" by
> > >>> ".isTransient()" and
> > >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> > >>>>  ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'.
> > >>>>
> > >>>>  Does the EL context need something else than adding the
> > >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> > objects? I
> > >>>>  don't understand why it works with ri-1.0.
> > >>>>
> > >>>>  Xavier
> > >>>>
> > >>>>
> > >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> > >>>>  To: users@tomee.apache.org
> > >>>>  Subject: Re: OpenEJB and EL
> > >>>>
> > >>>>  Hi Xavier
> > >>>>
> > >>>>  On the phone so hard to give you a link bit try using tomcat el
> impl
> > of
> > >>>>  tomcat 8.5
> > >>>>
> > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> > >>> a écrit :
> > >>>>
> > >>>>  > Hi,
> > >>>>  >
> > >>>>  > I am using OpenEJB for my tests and need support for EL
> > expressions in
> > >>> my
> > >>>>  > own code.
> > >>>>  >
> > >>>>  > By default, if I do something like this (pay attention to the
> > >>>>  expression):
> > >>>>  >
> > >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> > >>>>  > ExpressionFactory.newInstance( ));
> > >>>>  > StandardELContext elContext = new StandardELContext(factory);
> > >>>>  > elContext.addELResolver( beanManager.getELResolver());
> > >>>>  > ValueExpression expression = factory.createValueExpression(
> > elContext,
> > >>>>  > "#{javax.enterprise.context. conversation.transient}",
> > >>> Boolean.class);
> > >>>>  > expression.getValue(elContext) ;
> > >>>>  >
> > >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> > then I
> > >>>>  get
> > >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> > >>>>  > org.apache.el. ExpressionFactoryImpl
> > >>>>  >
> > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> > >>>>  PropertyNotFoundException:
> > >>>>  > ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'
> > >>>>  >
> > >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> > >>> META-INF/javax.el.
> > >>>>  ExpressionFactory
> > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> > >>> evaluated
> > >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> > >>>>  >
> > >>>>  > So, either my dependencies are wrong or I am not correctly
> > >>> initializing
> > >>>>  my
> > >>>>  > factory.
> > >>>>  >
> > >>>>  > Does anybody have an idea?
> > >>>>  >
> > >>>>  > Thanks,
> > >>>>  >
> > >>>>  > Xavier
> > >>>>
> > >>>>
> > >>>
> > >>
> > >
> > >
> > >
> >
> >
>
>
        

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
No, I didn't add the @Default to the @Produces method.

I verified:

@RequestScoped
public class ConversationWrapper {
	
	private @Inject Conversation conv;

	@Produces
	@Dependent
	@Named("conv")
	public Conversation getConv() {
		return conv;
	}
}

result:

Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type javax.enterprise.context.ConversationQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  conv, Bean Owner : [ConversationWrapper, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,eg.ConversationWrapper], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation, API Types:[java.lang.Object,org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API Types:[java.lang.Object,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] from file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class




From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 11:47 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
Types:[java.lang.Object,javax.enterprise.context.Conversation],
Qualifiers:[javax.enterprise.inject.Default,javax.
enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class

Why is there @Default there? producer should only have the @Named you set


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> It seems that to inject the conversation in ConversationWrapper.conversation,
> OWB does consider both the build-in conversation bean and the produced one
> from... ConversationWrapper.getConv().
>
> I tried something like that:
>
> @RequestScoped
> public class ConversationWrapper {
>
>         private @Inject @Named("javax.enterprise.context.conversation")
> Conversation conv;
>
>         @Produces
>         @Dependent
>         @Named("conv")
>         public Conversation getConv() {
>                 return conv;
>         }
> }
>
> But it gives the following error:
>
> Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [javax.enterprise.context.Conversation] is not found with the
> qualifiers
> Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> conversation)]
> for injection into Field Injection Point, field name :  conv, Bean Owner :
> [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationWrapper,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 11:34 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Got the same result with 'conv':
>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[java.lang.Object,eg.ConversationAliaser],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:29 PM
> To: users@tomee.apache.org
> Cc: Mark Struberg
> Subject: Re: OpenEJB and EL
>
> missing @Named("conv")?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> >
> > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> is
> > more than one Bean with type javax.enterprise.context.
> ConversationQualifiers:
> > [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :  conversation,
> Bean
> > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> > Types:[eg.ConversationAliaser,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> > found beans:
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> > ConversationImpl, WebBeansType:CONVERSATION,
> Name:javax.enterprise.context.conversation,
> > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> > javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >
> >
> >
> >
> >
> >
> >
> > From: Mark Struberg <st...@yahoo.de.INVALID>
> > Sent: Wednesday, September 28, 2016 11:20 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > +1
> >
> > means
> >
> > @RequestScoped
> >
> > public class ConversationWrapper {
> >   private @Inject Conversation conv;
> >
> >   @Produces
> >   @Dependent
> >   @Named("conv")
> >
> >   public Conversation getConv() {
> >     return conv;
> >   }
> > }
> >
> >
> >
> >
> > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> > rmannibucau@gmail.com> wrote:
> >
> >
> > >
> > >
> > >a producer allows to get a shorter/more elegant naming like #{conv.id}
> > if you @Produces @Named("conv") ;)
> > >
> > >
> > >
> > >Romain Manni-Bucau
> > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> > Tomitriber | JavaEE Factory
> > >
> > >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> > >
> > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> > >>
> > >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> > contradict each other.
> > >>
> > >>The Weld guys solved this by introducing a Javax class. But that takes
> > away the whole javax.* tree for the EL. That's just not good as it
> > contradicts the EL spec.
> > >>
> > >>Could you please try the following
> > >>
> > >>@RequestScoped
> > >>@Named("conversation")
> > >>public class ConversationWrapper {
> > >>   private @Inject Conversation conv;
> > >>
> > >>  public Conversation get() {
> > >>       return conv;
> > >>   }
> > >>}
> > >>
> > >>And in the EL just use #{conversation.get.id}
> > >>
> > >>LieGrue,
> > >>strub
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> > kalgon@hotmail.com> wrote:
> > >>> > I really don't understand how something like <f:param
> > >>> name="cid"
> > >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> > >>> works... something must be made to make the EL processor accept that
> > invalid
> > >>> bean name.
> > >>>
> > >>> Making a producer which @Produces @Named Conversation conflicts with
> > the
> > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> > >>>
> > >>> ... so, I have done the following for my tests but I feel a bit
> > ashamed because
> > >>> I can't imagine there is no better solution than this ;-)
> > >>>
> > >>> public class ConversationAliaser {
> > >>>     public class Javax {
> > >>>         public Enterprise getEnterprise() {return new Enterprise();}
> > >>>
> > >>>     }
> > >>>     public class Enterprise {
> > >>>         public Context getContext() {return new Context();}
> > >>>     }
> > >>>     public class Context {
> > >>>         public Conversation getConversation() {return conversation;}
> > >>>
> > >>>     }
> > >>>     @Inject
> > >>>     private Conversation conversation;
> > >>>     @Produces @ApplicationScoped @Named("javax")
> > >>>     public Javax javax() {return new Javax();}
> > >>> }
> > >>>
> > >>> But that works!
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>>
> > >>> From: Xavier Dury <ka...@hotmail.com>
> > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> > want to
> > >>> use it in ELs. I don't know if something like
> > >>> #{applicationScope['javax. enterprise.context.
> > conversation'].transient}
> > >>> would work?
> > >>>
> > >>> I remember back in my JSP days that, sometimes, I had to use
> something
> > like
> > >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> > >>> plain ${javax.servlet.forward. request_uri}.
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> hmm, wonder if it is linked to the value you try to evaluate (which
> > doesn't
> > >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> >
> >
> > System Dashboard - JBoss Issue Tracker
> > issues.jboss.org
> > Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> source
> > license for Red Hat ...
> > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
> >
> >
> > lists.jboss.org Mailing Lists
> > lists.jboss.org
> > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> > public mailing lists on lists.jboss.org. Click on a list name to get
> more
> > information ...
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau
> > >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>> twitter.com
> > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>> https://t.co/0VnvWwbedt . Blog ...
> > >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> > >>> <http://rmannibucau.wordpress. com> | Github
> > >>> <https://github.com/ rmannibucau> |
> > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> > >>> <http://www.tomitribe.com> | JavaEE Factory
> > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> > >>>
> > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >>>
> > >>>>  Hi Romain,
> > >>>>
> > >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> > not
> > >>>>  parse my expression until I change ".transient" by
> > >>> ".isTransient()" and
> > >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> > >>>>  ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'.
> > >>>>
> > >>>>  Does the EL context need something else than adding the
> > >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> > objects? I
> > >>>>  don't understand why it works with ri-1.0.
> > >>>>
> > >>>>  Xavier
> > >>>>
> > >>>>
> > >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> > >>>>  To: users@tomee.apache.org
> > >>>>  Subject: Re: OpenEJB and EL
> > >>>>
> > >>>>  Hi Xavier
> > >>>>
> > >>>>  On the phone so hard to give you a link bit try using tomcat el
> impl
> > of
> > >>>>  tomcat 8.5
> > >>>>
> > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> > >>> a écrit :
> > >>>>
> > >>>>  > Hi,
> > >>>>  >
> > >>>>  > I am using OpenEJB for my tests and need support for EL
> > expressions in
> > >>> my
> > >>>>  > own code.
> > >>>>  >
> > >>>>  > By default, if I do something like this (pay attention to the
> > >>>>  expression):
> > >>>>  >
> > >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> > >>>>  > ExpressionFactory.newInstance( ));
> > >>>>  > StandardELContext elContext = new StandardELContext(factory);
> > >>>>  > elContext.addELResolver( beanManager.getELResolver());
> > >>>>  > ValueExpression expression = factory.createValueExpression(
> > elContext,
> > >>>>  > "#{javax.enterprise.context. conversation.transient}",
> > >>> Boolean.class);
> > >>>>  > expression.getValue(elContext) ;
> > >>>>  >
> > >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> > then I
> > >>>>  get
> > >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> > >>>>  > org.apache.el. ExpressionFactoryImpl
> > >>>>  >
> > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> > >>>>  PropertyNotFoundException:
> > >>>>  > ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'
> > >>>>  >
> > >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> > >>> META-INF/javax.el.
> > >>>>  ExpressionFactory
> > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> > >>> evaluated
> > >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> > >>>>  >
> > >>>>  > So, either my dependencies are wrong or I am not correctly
> > >>> initializing
> > >>>>  my
> > >>>>  > factory.
> > >>>>  >
> > >>>>  > Does anybody have an idea?
> > >>>>  >
> > >>>>  > Thanks,
> > >>>>  >
> > >>>>  > Xavier
> > >>>>
> > >>>>
> > >>>
> > >>
> > >
> > >
> > >
> >
> >
>
>
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
Types:[java.lang.Object,javax.enterprise.context.Conversation],
Qualifiers:[javax.enterprise.inject.Default,javax.
enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class

Why is there @Default there? producer should only have the @Named you set


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:45 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> It seems that to inject the conversation in ConversationWrapper.conversation,
> OWB does consider both the build-in conversation bean and the produced one
> from... ConversationWrapper.getConv().
>
> I tried something like that:
>
> @RequestScoped
> public class ConversationWrapper {
>
>         private @Inject @Named("javax.enterprise.context.conversation")
> Conversation conv;
>
>         @Produces
>         @Dependent
>         @Named("conv")
>         public Conversation getConv() {
>                 return conv;
>         }
> }
>
> But it gives the following error:
>
> Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api
> type [javax.enterprise.context.Conversation] is not found with the
> qualifiers
> Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.
> conversation)]
> for injection into Field Injection Point, field name :  conv, Bean Owner :
> [ConversationWrapper, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationWrapper,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
>
>
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 11:34 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Got the same result with 'conv':
>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[java.lang.Object,eg.ConversationAliaser],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API
> Types:[java.lang.Object,javax.enterprise.context.Conversation],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 11:29 PM
> To: users@tomee.apache.org
> Cc: Mark Struberg
> Subject: Re: OpenEJB and EL
>
> missing @Named("conv")?
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
>
>
> RBlog: the RManniBucau v2 Blog
> blog-rmannibucau.rhcloud.com
> RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open
> Source, Code and geeky topics...
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
>
>
> [old blog] new RManniBucau().blog()
> rmannibucau.wordpress.com
> New blog on: https://blog-rmannibucau.rhcloud.com/
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> >
> > Caused by: javax.enterprise.inject.AmbiguousResolutionException: There
> is
> > more than one Bean with type javax.enterprise.context.
> ConversationQualifiers:
> > [@javax.enterprise.inject.Default()]
> > for injection into Field Injection Point, field name :  conversation,
> Bean
> > Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> > Types:[eg.ConversationAliaser,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any]]
> > found beans:
> > Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> > Types:[javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.
> > enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> > workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> > ConversationImpl, WebBeansType:CONVERSATION,
> Name:javax.enterprise.context.conversation,
> > API Types:[org.apache.webbeans.conversation.ConversationImpl,
> > javax.enterprise.context.Conversation,java.lang.Object],
> > Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> > from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> > openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> > 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
> >
> >
> >
> >
> >
> >
> >
> > From: Mark Struberg <st...@yahoo.de.INVALID>
> > Sent: Wednesday, September 28, 2016 11:20 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > +1
> >
> > means
> >
> > @RequestScoped
> >
> > public class ConversationWrapper {
> >   private @Inject Conversation conv;
> >
> >   @Produces
> >   @Dependent
> >   @Named("conv")
> >
> >   public Conversation getConv() {
> >     return conv;
> >   }
> > }
> >
> >
> >
> >
> > On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> > rmannibucau@gmail.com> wrote:
> >
> >
> > >
> > >
> > >a producer allows to get a shorter/more elegant naming like #{conv.id}
> > if you @Produces @Named("conv") ;)
> > >
> > >
> > >
> > >Romain Manni-Bucau
> > >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> > Tomitriber | JavaEE Factory
> > >
> > >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> > >
> > >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> > >>
> > >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> > contradict each other.
> > >>
> > >>The Weld guys solved this by introducing a Javax class. But that takes
> > away the whole javax.* tree for the EL. That's just not good as it
> > contradicts the EL spec.
> > >>
> > >>Could you please try the following
> > >>
> > >>@RequestScoped
> > >>@Named("conversation")
> > >>public class ConversationWrapper {
> > >>   private @Inject Conversation conv;
> > >>
> > >>  public Conversation get() {
> > >>       return conv;
> > >>   }
> > >>}
> > >>
> > >>And in the EL just use #{conversation.get.id}
> > >>
> > >>LieGrue,
> > >>strub
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> > kalgon@hotmail.com> wrote:
> > >>> > I really don't understand how something like <f:param
> > >>> name="cid"
> > >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> > >>> works... something must be made to make the EL processor accept that
> > invalid
> > >>> bean name.
> > >>>
> > >>> Making a producer which @Produces @Named Conversation conflicts with
> > the
> > >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> > >>>
> > >>> ... so, I have done the following for my tests but I feel a bit
> > ashamed because
> > >>> I can't imagine there is no better solution than this ;-)
> > >>>
> > >>> public class ConversationAliaser {
> > >>>     public class Javax {
> > >>>         public Enterprise getEnterprise() {return new Enterprise();}
> > >>>
> > >>>     }
> > >>>     public class Enterprise {
> > >>>         public Context getContext() {return new Context();}
> > >>>     }
> > >>>     public class Context {
> > >>>         public Conversation getConversation() {return conversation;}
> > >>>
> > >>>     }
> > >>>     @Inject
> > >>>     private Conversation conversation;
> > >>>     @Produces @ApplicationScoped @Named("javax")
> > >>>     public Javax javax() {return new Javax();}
> > >>> }
> > >>>
> > >>> But that works!
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>>
> > >>> From: Xavier Dury <ka...@hotmail.com>
> > >>> Sent: Wednesday, September 28, 2016 8:42 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> > want to
> > >>> use it in ELs. I don't know if something like
> > >>> #{applicationScope['javax. enterprise.context.
> > conversation'].transient}
> > >>> would work?
> > >>>
> > >>> I remember back in my JSP days that, sometimes, I had to use
> something
> > like
> > >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> > >>> plain ${javax.servlet.forward. request_uri}.
> > >>>
> > >>> Xavier
> > >>>
> > >>>
> > >>> From: Romain Manni-Bucau <rm...@gmail.com>
> > >>> Sent: Wednesday, September 28, 2016 6:54 PM
> > >>> To: users@tomee.apache.org
> > >>> Subject: Re: OpenEJB and EL
> > >>>
> > >>> hmm, wonder if it is linked to the value you try to evaluate (which
> > doesn't
> > >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> > >>> https://issues.jboss.org/ browse/CDITCK-462 /
> >
> >
> > System Dashboard - JBoss Issue Tracker
> > issues.jboss.org
> > Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> > About JIRA; Report a problem; Powered by a free Atlassian JIRA open
> source
> > license for Red Hat ...
> > >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
> >
> >
> > lists.jboss.org Mailing Lists
> > lists.jboss.org
> > lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> > public mailing lists on lists.jboss.org. Click on a list name to get
> more
> > information ...
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau
> > >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> > >>>
> > >>>
> > >>>
> > >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> > >>> twitter.com
> > >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> > Java(EE) /
> > >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > >>> https://t.co/0VnvWwbedt . Blog ...
> > >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> > >>> <http://rmannibucau.wordpress. com> | Github
> > >>> <https://github.com/ rmannibucau> |
> > >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> > >>> <http://www.tomitribe.com> | JavaEE Factory
> > >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> > >>>
> > >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> > >>>
> > >>>>  Hi Romain,
> > >>>>
> > >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> > not
> > >>>>  parse my expression until I change ".transient" by
> > >>> ".isTransient()" and
> > >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> > >>>>  ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'.
> > >>>>
> > >>>>  Does the EL context need something else than adding the
> > >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> > objects? I
> > >>>>  don't understand why it works with ri-1.0.
> > >>>>
> > >>>>  Xavier
> > >>>>
> > >>>>
> > >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> > >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> > >>>>  To: users@tomee.apache.org
> > >>>>  Subject: Re: OpenEJB and EL
> > >>>>
> > >>>>  Hi Xavier
> > >>>>
> > >>>>  On the phone so hard to give you a link bit try using tomcat el
> impl
> > of
> > >>>>  tomcat 8.5
> > >>>>
> > >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> > >>> a écrit :
> > >>>>
> > >>>>  > Hi,
> > >>>>  >
> > >>>>  > I am using OpenEJB for my tests and need support for EL
> > expressions in
> > >>> my
> > >>>>  > own code.
> > >>>>  >
> > >>>>  > By default, if I do something like this (pay attention to the
> > >>>>  expression):
> > >>>>  >
> > >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> > >>>>  > ExpressionFactory.newInstance( ));
> > >>>>  > StandardELContext elContext = new StandardELContext(factory);
> > >>>>  > elContext.addELResolver( beanManager.getELResolver());
> > >>>>  > ValueExpression expression = factory.createValueExpression(
> > elContext,
> > >>>>  > "#{javax.enterprise.context. conversation.transient}",
> > >>> Boolean.class);
> > >>>>  > expression.getValue(elContext) ;
> > >>>>  >
> > >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> > then I
> > >>>>  get
> > >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> > >>>>  > org.apache.el. ExpressionFactoryImpl
> > >>>>  >
> > >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> > >>>>  PropertyNotFoundException:
> > >>>>  > ELResolver cannot handle a null base Object with identifier
> > >>> 'javax'
> > >>>>  >
> > >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> > >>> META-INF/javax.el.
> > >>>>  ExpressionFactory
> > >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> > >>> evaluated
> > >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> > >>>>  >
> > >>>>  > So, either my dependencies are wrong or I am not correctly
> > >>> initializing
> > >>>>  my
> > >>>>  > factory.
> > >>>>  >
> > >>>>  > Does anybody have an idea?
> > >>>>  >
> > >>>>  > Thanks,
> > >>>>  >
> > >>>>  > Xavier
> > >>>>
> > >>>>
> > >>>
> > >>
> > >
> > >
> > >
> >
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
It seems that to inject the conversation in ConversationWrapper.conversation, OWB does consider both the build-in conversation bean and the produced one from... ConversationWrapper.getConv().

I tried something like that:

@RequestScoped
public class ConversationWrapper {
	
	private @Inject @Named("javax.enterprise.context.conversation") Conversation conv;

	@Produces
	@Dependent
	@Named("conv")
	public Conversation getConv() {
		return conv;
	}
}

But it gives the following error:

Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [javax.enterprise.context.Conversation] is not found with the qualifiers 
Qualifiers: [@javax.inject.Named(value=javax.enterprise.context.conversation)]
for injection into Field Injection Point, field name :  conv, Bean Owner : [ConversationWrapper, WebBeansType:MANAGED, Name:null, API Types:[eg.ConversationWrapper,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
	



From: Xavier Dury <ka...@hotmail.com>
Sent: Wednesday, September 28, 2016 11:34 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Got the same result with 'conv':

Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type javax.enterprise.context.ConversationQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  conversation, Bean Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,eg.ConversationAliaser], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API Types:[java.lang.Object,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] from file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation, API Types:[org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]  from jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class







From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 11:29 PM
To: users@tomee.apache.org
Cc: Mark Struberg
Subject: Re: OpenEJB and EL
    
missing @Named("conv")?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationAliaser,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> Types:[javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Wednesday, September 28, 2016 11:20 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> +1
>
> means
>
> @RequestScoped
>
> public class ConversationWrapper {
>   private @Inject Conversation conv;
>
>   @Produces
>   @Dependent
>   @Named("conv")
>
>   public Conversation getConv() {
>     return conv;
>   }
> }
>
>
>
>
> On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
>
>
> >
> >
> >a producer allows to get a shorter/more elegant naming like #{conv.id}
> if you @Produces @Named("conv") ;)
> >
> >
> >
> >Romain Manni-Bucau
> >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> Tomitriber | JavaEE Factory
> >
> >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> >
> >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> >>
> >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> contradict each other.
> >>
> >>The Weld guys solved this by introducing a Javax class. But that takes
> away the whole javax.* tree for the EL. That's just not good as it
> contradicts the EL spec.
> >>
> >>Could you please try the following
> >>
> >>@RequestScoped
> >>@Named("conversation")
> >>public class ConversationWrapper {
> >>   private @Inject Conversation conv;
> >>
> >>  public Conversation get() {
> >>       return conv;
> >>   }
> >>}
> >>
> >>And in the EL just use #{conversation.get.id}
> >>
> >>LieGrue,
> >>strub
> >>
> >>
> >>
> >>
> >>
> >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> kalgon@hotmail.com> wrote:
> >>> > I really don't understand how something like <f:param
> >>> name="cid"
> >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> >>> works... something must be made to make the EL processor accept that
> invalid
> >>> bean name.
> >>>
> >>> Making a producer which @Produces @Named Conversation conflicts with
> the
> >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >>>
> >>> ... so, I have done the following for my tests but I feel a bit
> ashamed because
> >>> I can't imagine there is no better solution than this ;-)
> >>>
> >>> public class ConversationAliaser {
> >>>     public class Javax {
> >>>         public Enterprise getEnterprise() {return new Enterprise();}
> >>>
> >>>     }
> >>>     public class Enterprise {
> >>>         public Context getContext() {return new Context();}
> >>>     }
> >>>     public class Context {
> >>>         public Conversation getConversation() {return conversation;}
> >>>
> >>>     }
> >>>     @Inject
> >>>     private Conversation conversation;
> >>>     @Produces @ApplicationScoped @Named("javax")
> >>>     public Javax javax() {return new Javax();}
> >>> }
> >>>
> >>> But that works!
> >>>
> >>> Xavier
> >>>
> >>>
> >>>
> >>> From: Xavier Dury <ka...@hotmail.com>
> >>> Sent: Wednesday, September 28, 2016 8:42 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> want to
> >>> use it in ELs. I don't know if something like
> >>> #{applicationScope['javax. enterprise.context.
> conversation'].transient}
> >>> would work?
> >>>
> >>> I remember back in my JSP days that, sometimes, I had to use something
> like
> >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> >>> plain ${javax.servlet.forward. request_uri}.
> >>>
> >>> Xavier
> >>>
> >>>
> >>> From: Romain Manni-Bucau <rm...@gmail.com>
> >>> Sent: Wednesday, September 28, 2016 6:54 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> hmm, wonder if it is linked to the value you try to evaluate (which
> doesn't
> >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> >>> https://issues.jboss.org/ browse/CDITCK-462 /
>
>
> System Dashboard - JBoss Issue Tracker
> issues.jboss.org
> Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> About JIRA; Report a problem; Powered by a free Atlassian JIRA open source
> license for Red Hat ...
> >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
>
>
> lists.jboss.org Mailing Lists
> lists.jboss.org
> lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> public mailing lists on lists.jboss.org. Click on a list name to get more
> information ...
> >>>
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> >>> twitter.com
> >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>> https://t.co/0VnvWwbedt . Blog ...
> >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> >>> <http://rmannibucau.wordpress. com> | Github
> >>> <https://github.com/ rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> >>> <http://www.tomitribe.com> | JavaEE Factory
> >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> >>>
> >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>>
> >>>>  Hi Romain,
> >>>>
> >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> not
> >>>>  parse my expression until I change ".transient" by
> >>> ".isTransient()" and
> >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> >>>>  ELResolver cannot handle a null base Object with identifier
> >>> 'javax'.
> >>>>
> >>>>  Does the EL context need something else than adding the
> >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> >>>>  don't understand why it works with ri-1.0.
> >>>>
> >>>>  Xavier
> >>>>
> >>>>
> >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>>>  To: users@tomee.apache.org
> >>>>  Subject: Re: OpenEJB and EL
> >>>>
> >>>>  Hi Xavier
> >>>>
> >>>>  On the phone so hard to give you a link bit try using tomcat el impl
> of
> >>>>  tomcat 8.5
> >>>>
> >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> >>> a écrit :
> >>>>
> >>>>  > Hi,
> >>>>  >
> >>>>  > I am using OpenEJB for my tests and need support for EL
> expressions in
> >>> my
> >>>>  > own code.
> >>>>  >
> >>>>  > By default, if I do something like this (pay attention to the
> >>>>  expression):
> >>>>  >
> >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> >>>>  > ExpressionFactory.newInstance( ));
> >>>>  > StandardELContext elContext = new StandardELContext(factory);
> >>>>  > elContext.addELResolver( beanManager.getELResolver());
> >>>>  > ValueExpression expression = factory.createValueExpression(
> elContext,
> >>>>  > "#{javax.enterprise.context. conversation.transient}",
> >>> Boolean.class);
> >>>>  > expression.getValue(elContext) ;
> >>>>  >
> >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> then I
> >>>>  get
> >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> >>>>  > org.apache.el. ExpressionFactoryImpl
> >>>>  >
> >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> >>>>  PropertyNotFoundException:
> >>>>  > ELResolver cannot handle a null base Object with identifier
> >>> 'javax'
> >>>>  >
> >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> >>> META-INF/javax.el.
> >>>>  ExpressionFactory
> >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> >>> evaluated
> >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> >>>>  >
> >>>>  > So, either my dependencies are wrong or I am not correctly
> >>> initializing
> >>>>  my
> >>>>  > factory.
> >>>>  >
> >>>>  > Does anybody have an idea?
> >>>>  >
> >>>>  > Thanks,
> >>>>  >
> >>>>  > Xavier
> >>>>
> >>>>
> >>>
> >>
> >
> >
> >
>
>
        

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Got the same result with 'conv':

Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type javax.enterprise.context.ConversationQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  conversation, Bean Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,eg.ConversationAliaser], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
Conversation, WebBeansType:PRODUCERMETHOD, Name:conv, API Types:[java.lang.Object,javax.enterprise.context.Conversation], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] from file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation, API Types:[org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class







From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 11:29 PM
To: users@tomee.apache.org
Cc: Mark Struberg
Subject: Re: OpenEJB and EL
    
missing @Named("conv")?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog


RBlog: the RManniBucau v2 Blog
blog-rmannibucau.rhcloud.com
RBlog: Romain Manni-Bucau Blog about Java, JavaEE, TomEE, Angular, Open Source, Code and geeky topics...
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |


[old blog] new RManniBucau().blog()
rmannibucau.wordpress.com
New blog on: https://blog-rmannibucau.rhcloud.com/
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationAliaser,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> Types:[javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Wednesday, September 28, 2016 11:20 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> +1
>
> means
>
> @RequestScoped
>
> public class ConversationWrapper {
>   private @Inject Conversation conv;
>
>   @Produces
>   @Dependent
>   @Named("conv")
>
>   public Conversation getConv() {
>     return conv;
>   }
> }
>
>
>
>
> On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
>
>
> >
> >
> >a producer allows to get a shorter/more elegant naming like #{conv.id}
> if you @Produces @Named("conv") ;)
> >
> >
> >
> >Romain Manni-Bucau
> >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> Tomitriber | JavaEE Factory
> >
> >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> >
> >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> >>
> >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> contradict each other.
> >>
> >>The Weld guys solved this by introducing a Javax class. But that takes
> away the whole javax.* tree for the EL. That's just not good as it
> contradicts the EL spec.
> >>
> >>Could you please try the following
> >>
> >>@RequestScoped
> >>@Named("conversation")
> >>public class ConversationWrapper {
> >>   private @Inject Conversation conv;
> >>
> >>  public Conversation get() {
> >>       return conv;
> >>   }
> >>}
> >>
> >>And in the EL just use #{conversation.get.id}
> >>
> >>LieGrue,
> >>strub
> >>
> >>
> >>
> >>
> >>
> >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> kalgon@hotmail.com> wrote:
> >>> > I really don't understand how something like <f:param
> >>> name="cid"
> >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> >>> works... something must be made to make the EL processor accept that
> invalid
> >>> bean name.
> >>>
> >>> Making a producer which @Produces @Named Conversation conflicts with
> the
> >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >>>
> >>> ... so, I have done the following for my tests but I feel a bit
> ashamed because
> >>> I can't imagine there is no better solution than this ;-)
> >>>
> >>> public class ConversationAliaser {
> >>>     public class Javax {
> >>>         public Enterprise getEnterprise() {return new Enterprise();}
> >>>
> >>>     }
> >>>     public class Enterprise {
> >>>         public Context getContext() {return new Context();}
> >>>     }
> >>>     public class Context {
> >>>         public Conversation getConversation() {return conversation;}
> >>>
> >>>     }
> >>>     @Inject
> >>>     private Conversation conversation;
> >>>     @Produces @ApplicationScoped @Named("javax")
> >>>     public Javax javax() {return new Javax();}
> >>> }
> >>>
> >>> But that works!
> >>>
> >>> Xavier
> >>>
> >>>
> >>>
> >>> From: Xavier Dury <ka...@hotmail.com>
> >>> Sent: Wednesday, September 28, 2016 8:42 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> want to
> >>> use it in ELs. I don't know if something like
> >>> #{applicationScope['javax. enterprise.context.
> conversation'].transient}
> >>> would work?
> >>>
> >>> I remember back in my JSP days that, sometimes, I had to use something
> like
> >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> >>> plain ${javax.servlet.forward. request_uri}.
> >>>
> >>> Xavier
> >>>
> >>>
> >>> From: Romain Manni-Bucau <rm...@gmail.com>
> >>> Sent: Wednesday, September 28, 2016 6:54 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> hmm, wonder if it is linked to the value you try to evaluate (which
> doesn't
> >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> >>> https://issues.jboss.org/ browse/CDITCK-462 /
>
>
> System Dashboard - JBoss Issue Tracker
> issues.jboss.org
> Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> About JIRA; Report a problem; Powered by a free Atlassian JIRA open source
> license for Red Hat ...
> >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
>
>
> lists.jboss.org Mailing Lists
> lists.jboss.org
> lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> public mailing lists on lists.jboss.org. Click on a list name to get more
> information ...
> >>>
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> >>> twitter.com
> >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>> https://t.co/0VnvWwbedt . Blog ...
> >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> >>> <http://rmannibucau.wordpress. com> | Github
> >>> <https://github.com/ rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> >>> <http://www.tomitribe.com> | JavaEE Factory
> >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> >>>
> >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>>
> >>>>  Hi Romain,
> >>>>
> >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> not
> >>>>  parse my expression until I change ".transient" by
> >>> ".isTransient()" and
> >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> >>>>  ELResolver cannot handle a null base Object with identifier
> >>> 'javax'.
> >>>>
> >>>>  Does the EL context need something else than adding the
> >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> >>>>  don't understand why it works with ri-1.0.
> >>>>
> >>>>  Xavier
> >>>>
> >>>>
> >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>>>  To: users@tomee.apache.org
> >>>>  Subject: Re: OpenEJB and EL
> >>>>
> >>>>  Hi Xavier
> >>>>
> >>>>  On the phone so hard to give you a link bit try using tomcat el impl
> of
> >>>>  tomcat 8.5
> >>>>
> >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> >>> a écrit :
> >>>>
> >>>>  > Hi,
> >>>>  >
> >>>>  > I am using OpenEJB for my tests and need support for EL
> expressions in
> >>> my
> >>>>  > own code.
> >>>>  >
> >>>>  > By default, if I do something like this (pay attention to the
> >>>>  expression):
> >>>>  >
> >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> >>>>  > ExpressionFactory.newInstance( ));
> >>>>  > StandardELContext elContext = new StandardELContext(factory);
> >>>>  > elContext.addELResolver( beanManager.getELResolver());
> >>>>  > ValueExpression expression = factory.createValueExpression(
> elContext,
> >>>>  > "#{javax.enterprise.context. conversation.transient}",
> >>> Boolean.class);
> >>>>  > expression.getValue(elContext) ;
> >>>>  >
> >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> then I
> >>>>  get
> >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> >>>>  > org.apache.el. ExpressionFactoryImpl
> >>>>  >
> >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> >>>>  PropertyNotFoundException:
> >>>>  > ELResolver cannot handle a null base Object with identifier
> >>> 'javax'
> >>>>  >
> >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> >>> META-INF/javax.el.
> >>>>  ExpressionFactory
> >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> >>> evaluated
> >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> >>>>  >
> >>>>  > So, either my dependencies are wrong or I am not correctly
> >>> initializing
> >>>>  my
> >>>>  > factory.
> >>>>  >
> >>>>  > Does anybody have an idea?
> >>>>  >
> >>>>  > Thanks,
> >>>>  >
> >>>>  > Xavier
> >>>>
> >>>>
> >>>
> >>
> >
> >
> >
>
>
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
missing @Named("conv")?


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:27 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

>
> Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is
> more than one Bean with type javax.enterprise.context.ConversationQualifiers:
> [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  conversation, Bean
> Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API
> Types:[eg.ConversationAliaser,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
> found beans:
> Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API
> Types:[javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.
> enterprise.inject.Any,javax.inject.Named] from file:/D:/development/
> workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
> ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation,
> API Types:[org.apache.webbeans.conversation.ConversationImpl,
> javax.enterprise.context.Conversation,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]
> from jar:file:/C:/Users/xavier/.m2/repository/org/apache/
> openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-
> 1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class
>
>
>
>
>
>
>
> From: Mark Struberg <st...@yahoo.de.INVALID>
> Sent: Wednesday, September 28, 2016 11:20 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> +1
>
> means
>
> @RequestScoped
>
> public class ConversationWrapper {
>   private @Inject Conversation conv;
>
>   @Produces
>   @Dependent
>   @Named("conv")
>
>   public Conversation getConv() {
>     return conv;
>   }
> }
>
>
>
>
> On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
>
>
> >
> >
> >a producer allows to get a shorter/more elegant naming like #{conv.id}
> if you @Produces @Named("conv") ;)
> >
> >
> >
> >Romain Manni-Bucau
> >@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn |
> Tomitriber | JavaEE Factory
> >
> >2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
> >
> >Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
> >>
> >>Problem is that the EE umbrella spec, the EL spec and the CDI spec
> contradict each other.
> >>
> >>The Weld guys solved this by introducing a Javax class. But that takes
> away the whole javax.* tree for the EL. That's just not good as it
> contradicts the EL spec.
> >>
> >>Could you please try the following
> >>
> >>@RequestScoped
> >>@Named("conversation")
> >>public class ConversationWrapper {
> >>   private @Inject Conversation conv;
> >>
> >>  public Conversation get() {
> >>       return conv;
> >>   }
> >>}
> >>
> >>And in the EL just use #{conversation.get.id}
> >>
> >>LieGrue,
> >>strub
> >>
> >>
> >>
> >>
> >>
> >>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <
> kalgon@hotmail.com> wrote:
> >>> > I really don't understand how something like <f:param
> >>> name="cid"
> >>> value="#{javax.enterprise. context.conversation.id}"/> actually
> >>> works... something must be made to make the EL processor accept that
> invalid
> >>> bean name.
> >>>
> >>> Making a producer which @Produces @Named Conversation conflicts with
> the
> >>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >>>
> >>> ... so, I have done the following for my tests but I feel a bit
> ashamed because
> >>> I can't imagine there is no better solution than this ;-)
> >>>
> >>> public class ConversationAliaser {
> >>>     public class Javax {
> >>>         public Enterprise getEnterprise() {return new Enterprise();}
> >>>
> >>>     }
> >>>     public class Enterprise {
> >>>         public Context getContext() {return new Context();}
> >>>     }
> >>>     public class Context {
> >>>         public Conversation getConversation() {return conversation;}
> >>>
> >>>     }
> >>>     @Inject
> >>>     private Conversation conversation;
> >>>     @Produces @ApplicationScoped @Named("javax")
> >>>     public Javax javax() {return new Javax();}
> >>> }
> >>>
> >>> But that works!
> >>>
> >>> Xavier
> >>>
> >>>
> >>>
> >>> From: Xavier Dury <ka...@hotmail.com>
> >>> Sent: Wednesday, September 28, 2016 8:42 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> Hmmm... I guess I'll have to @Produces @Named the conversation if I
> want to
> >>> use it in ELs. I don't know if something like
> >>> #{applicationScope['javax. enterprise.context.
> conversation'].transient}
> >>> would work?
> >>>
> >>> I remember back in my JSP days that, sometimes, I had to use something
> like
> >>> ${requestScope['javax.servlet. forward.request_uri']} instead of
> >>> plain ${javax.servlet.forward. request_uri}.
> >>>
> >>> Xavier
> >>>
> >>>
> >>> From: Romain Manni-Bucau <rm...@gmail.com>
> >>> Sent: Wednesday, September 28, 2016 6:54 PM
> >>> To: users@tomee.apache.org
> >>> Subject: Re: OpenEJB and EL
> >>>
> >>> hmm, wonder if it is linked to the value you try to evaluate (which
> doesn't
> >>> respect EL spec even if in CDI spec - don't ask please ;)).. See
> >>> https://issues.jboss.org/ browse/CDITCK-462 /
>
>
> System Dashboard - JBoss Issue Tracker
> issues.jboss.org
> Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4)
> About JIRA; Report a problem; Powered by a free Atlassian JIRA open source
> license for Red Hat ...
> >>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
>
>
> lists.jboss.org Mailing Lists
> lists.jboss.org
> lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the
> public mailing lists on lists.jboss.org. Click on a list name to get more
> information ...
> >>>
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau (@rmannibucau) | Twitter
> >>> twitter.com
> >>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF /
> Java(EE) /
> >>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> >>> https://t.co/0VnvWwbedt . Blog ...
> >>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
> >>> <http://rmannibucau.wordpress. com> | Github
> >>> <https://github.com/ rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
> >>> <http://www.tomitribe.com> | JavaEE Factory
> >>> <https://javaeefactory- rmannibucau.rhcloud.com>
> >>>
> >>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >>>
> >>>>  Hi Romain,
> >>>>
> >>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does
> not
> >>>>  parse my expression until I change ".transient" by
> >>> ".isTransient()" and
> >>>>  then it gives the same error: javax.el. PropertyNotFoundException:
> >>>>  ELResolver cannot handle a null base Object with identifier
> >>> 'javax'.
> >>>>
> >>>>  Does the EL context need something else than adding the
> >>>>  BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> >>>>  don't understand why it works with ri-1.0.
> >>>>
> >>>>  Xavier
> >>>>
> >>>>
> >>>>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>>>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>>>  To: users@tomee.apache.org
> >>>>  Subject: Re: OpenEJB and EL
> >>>>
> >>>>  Hi Xavier
> >>>>
> >>>>  On the phone so hard to give you a link bit try using tomcat el impl
> of
> >>>>  tomcat 8.5
> >>>>
> >>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> >>> a écrit :
> >>>>
> >>>>  > Hi,
> >>>>  >
> >>>>  > I am using OpenEJB for my tests and need support for EL
> expressions in
> >>> my
> >>>>  > own code.
> >>>>  >
> >>>>  > By default, if I do something like this (pay attention to the
> >>>>  expression):
> >>>>  >
> >>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
> >>>>  > ExpressionFactory.newInstance( ));
> >>>>  > StandardELContext elContext = new StandardELContext(factory);
> >>>>  > elContext.addELResolver( beanManager.getELResolver());
> >>>>  > ValueExpression expression = factory.createValueExpression(
> elContext,
> >>>>  > "#{javax.enterprise.context. conversation.transient}",
> >>> Boolean.class);
> >>>>  > expression.getValue(elContext) ;
> >>>>  >
> >>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project
> then I
> >>>>  get
> >>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> >>>>  > org.apache.el. ExpressionFactoryImpl
> >>>>  >
> >>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> >>>>  PropertyNotFoundException:
> >>>>  > ELResolver cannot handle a null base Object with identifier
> >>> 'javax'
> >>>>  >
> >>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> >>> META-INF/javax.el.
> >>>>  ExpressionFactory
> >>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
> >>> evaluated
> >>>>  > but I can't use any new feature of 3.0 (like lambdas)
> >>>>  >
> >>>>  > So, either my dependencies are wrong or I am not correctly
> >>> initializing
> >>>>  my
> >>>>  > factory.
> >>>>  >
> >>>>  > Does anybody have an idea?
> >>>>  >
> >>>>  > Thanks,
> >>>>  >
> >>>>  > Xavier
> >>>>
> >>>>
> >>>
> >>
> >
> >
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Caused by: javax.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type javax.enterprise.context.ConversationQualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  conversation, Bean Owner : [ConversationAliaser, WebBeansType:MANAGED, Name:null, API Types:[eg.ConversationAliaser,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any]]
found beans: 
Conversation, WebBeansType:PRODUCERMETHOD, Name:conversation, API Types:[javax.enterprise.context.Conversation,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named] from file:/D:/development/workspaces/openejb-el/target/test-classes/eg/ConversationWrapper.class
ConversationImpl, WebBeansType:CONVERSATION, Name:javax.enterprise.context.conversation, API Types:[org.apache.webbeans.conversation.ConversationImpl,javax.enterprise.context.Conversation,java.lang.Object], Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any] from jar:file:/C:/Users/xavier/.m2/repository/org/apache/openwebbeans/openwebbeans-impl/1.6.3/openwebbeans-impl-1.6.3.jar!/org/apache/webbeans/conversation/ConversationImpl.class







From: Mark Struberg <st...@yahoo.de.INVALID>
Sent: Wednesday, September 28, 2016 11:20 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
+1

means

@RequestScoped

public class ConversationWrapper {
  private @Inject Conversation conv;

  @Produces
  @Dependent
  @Named("conv")

  public Conversation getConv() {
    return conv;
  }
}




On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <rm...@gmail.com> wrote:


>
>
>a producer allows to get a shorter/more elegant naming like #{conv.id} if you @Produces @Named("conv") ;)
>
>
>
>Romain Manni-Bucau
>@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn | Tomitriber | JavaEE Factory
>
>2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
>
>Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>>
>>Problem is that the EE umbrella spec, the EL spec and the CDI spec contradict each other.
>>
>>The Weld guys solved this by introducing a Javax class. But that takes away the whole javax.* tree for the EL. That's just not good as it contradicts the EL spec.
>>
>>Could you please try the following
>>
>>@RequestScoped
>>@Named("conversation")
>>public class ConversationWrapper {
>>   private @Inject Conversation conv;
>>
>>  public Conversation get() {
>>       return conv;
>>   }
>>}
>>
>>And in the EL just use #{conversation.get.id}
>>
>>LieGrue,
>>strub
>>
>>
>>
>>
>>
>>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <ka...@hotmail.com> wrote:
>>> > I really don't understand how something like <f:param
>>> name="cid"
>>> value="#{javax.enterprise. context.conversation.id}"/> actually
>>> works... something must be made to make the EL processor accept that invalid
>>> bean name.
>>>
>>> Making a producer which @Produces @Named Conversation conflicts with the
>>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
>>>
>>> ... so, I have done the following for my tests but I feel a bit ashamed because
>>> I can't imagine there is no better solution than this ;-)
>>>
>>> public class ConversationAliaser {
>>>     public class Javax {
>>>         public Enterprise getEnterprise() {return new Enterprise();}
>>>
>>>     }
>>>     public class Enterprise {
>>>         public Context getContext() {return new Context();}
>>>     }
>>>     public class Context {
>>>         public Conversation getConversation() {return conversation;}
>>>
>>>     }
>>>     @Inject
>>>     private Conversation conversation;
>>>     @Produces @ApplicationScoped @Named("javax")
>>>     public Javax javax() {return new Javax();}
>>> }
>>>
>>> But that works!
>>>
>>> Xavier
>>>
>>>
>>>
>>> From: Xavier Dury <ka...@hotmail.com>
>>> Sent: Wednesday, September 28, 2016 8:42 PM
>>> To: users@tomee.apache.org
>>> Subject: Re: OpenEJB and EL
>>>
>>> Hmmm... I guess I'll have to @Produces @Named the conversation if I want to
>>> use it in ELs. I don't know if something like
>>> #{applicationScope['javax. enterprise.context. conversation'].transient}
>>> would work?
>>>
>>> I remember back in my JSP days that, sometimes, I had to use something like
>>> ${requestScope['javax.servlet. forward.request_uri']} instead of
>>> plain ${javax.servlet.forward. request_uri}.
>>>
>>> Xavier
>>>
>>>
>>> From: Romain Manni-Bucau <rm...@gmail.com>
>>> Sent: Wednesday, September 28, 2016 6:54 PM
>>> To: users@tomee.apache.org
>>> Subject: Re: OpenEJB and EL
>>>
>>> hmm, wonder if it is linked to the value you try to evaluate (which doesn't
>>> respect EL spec even if in CDI spec - don't ask please ;)).. See
>>> https://issues.jboss.org/ browse/CDITCK-462 /


System Dashboard - JBoss Issue Tracker
issues.jboss.org
Atlassian JIRA Project Management Software (v6.4.11#64026-sha1:78f6ec4) About JIRA; Report a problem; Powered by a free Atlassian JIRA open source license for Red Hat ...
>>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html


lists.jboss.org Mailing Lists
lists.jboss.org
lists.jboss.org Mailing Lists: Welcome! Below is a listing of all the public mailing lists on lists.jboss.org. Click on a list name to get more information ...
>>>
>>>
>>>
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
>>>
>>>
>>>
>>> Romain Manni-Bucau (@rmannibucau) | Twitter
>>> twitter.com
>>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>> https://t.co/0VnvWwbedt . Blog ...
>>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
>>> <http://rmannibucau.wordpress. com> | Github
>>> <https://github.com/ rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
>>> <http://www.tomitribe.com> | JavaEE Factory
>>> <https://javaeefactory- rmannibucau.rhcloud.com>
>>>
>>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>>>
>>>>  Hi Romain,
>>>>
>>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does not
>>>>  parse my expression until I change ".transient" by
>>> ".isTransient()" and
>>>>  then it gives the same error: javax.el. PropertyNotFoundException:
>>>>  ELResolver cannot handle a null base Object with identifier
>>> 'javax'.
>>>>
>>>>  Does the EL context need something else than adding the
>>>>  BeanManager.getELResolver()  to be able to resolve some implicit objects? I
>>>>  don't understand why it works with ri-1.0.
>>>>
>>>>  Xavier
>>>>
>>>>
>>>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>>>  Sent: Wednesday, September 28, 2016 4:02 PM
>>>>  To: users@tomee.apache.org
>>>>  Subject: Re: OpenEJB and EL
>>>>
>>>>  Hi Xavier
>>>>
>>>>  On the phone so hard to give you a link bit try using tomcat el impl of
>>>>  tomcat 8.5
>>>>
>>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
>>> a écrit :
>>>>
>>>>  > Hi,
>>>>  >
>>>>  > I am using OpenEJB for my tests and need support for EL expressions in
>>> my
>>>>  > own code.
>>>>  >
>>>>  > By default, if I do something like this (pay attention to the
>>>>  expression):
>>>>  >
>>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
>>>>  > ExpressionFactory.newInstance( ));
>>>>  > StandardELContext elContext = new StandardELContext(factory);
>>>>  > elContext.addELResolver( beanManager.getELResolver());
>>>>  > ValueExpression expression = factory.createValueExpression( elContext,
>>>>  > "#{javax.enterprise.context. conversation.transient}",
>>> Boolean.class);
>>>>  > expression.getValue(elContext) ;
>>>>  >
>>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project then I
>>>>  get
>>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
>>>>  > org.apache.el. ExpressionFactoryImpl
>>>>  >
>>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
>>>>  PropertyNotFoundException:
>>>>  > ELResolver cannot handle a null base Object with identifier
>>> 'javax'
>>>>  >
>>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
>>> META-INF/javax.el.
>>>>  ExpressionFactory
>>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
>>> evaluated
>>>>  > but I can't use any new feature of 3.0 (like lambdas)
>>>>  >
>>>>  > So, either my dependencies are wrong or I am not correctly
>>> initializing
>>>>  my
>>>>  > factory.
>>>>  >
>>>>  > Does anybody have an idea?
>>>>  >
>>>>  > Thanks,
>>>>  >
>>>>  > Xavier
>>>>
>>>>
>>>
>>
>
>
>
    

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
+1

means

@RequestScoped

public class ConversationWrapper {
  private @Inject Conversation conv;

  @Produces
  @Dependent
  @Named("conv")

  public Conversation getConv() {
    return conv;
  }
}




On Wednesday, 28 September 2016, 23:10, Romain Manni-Bucau <rm...@gmail.com> wrote:


>
>
>a producer allows to get a shorter/more elegant naming like #{conv.id} if you @Produces @Named("conv") ;)
>
>
>
>Romain Manni-Bucau
>@rmannibucau |  Blog | Old Wordpress Blog | Github | LinkedIn | Tomitriber | JavaEE Factory
>
>2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:
>
>Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>>
>>Problem is that the EE umbrella spec, the EL spec and the CDI spec contradict each other.
>>
>>The Weld guys solved this by introducing a Javax class. But that takes away the whole javax.* tree for the EL. That's just not good as it contradicts the EL spec.
>>
>>Could you please try the following
>>
>>@RequestScoped
>>@Named("conversation")
>>public class ConversationWrapper {
>>   private @Inject Conversation conv;
>>
>>  public Conversation get() {
>>       return conv;
>>   }
>>}
>>
>>And in the EL just use #{conversation.get.id}
>>
>>LieGrue,
>>strub
>>
>>
>>
>>
>>
>>> On Wednesday, 28 September 2016, 22:12, Xavier Dury <ka...@hotmail.com> wrote:
>>> > I really don't understand how something like <f:param
>>> name="cid"
>>> value="#{javax.enterprise. context.conversation.id}"/> actually
>>> works... something must be made to make the EL processor accept that invalid
>>> bean name.
>>>
>>> Making a producer which @Produces @Named Conversation conflicts with the
>>> built-in bean from OWB (with WebBeanType.CONVERSATION)...
>>>
>>> ... so, I have done the following for my tests but I feel a bit ashamed because
>>> I can't imagine there is no better solution than this ;-)
>>>
>>> public class ConversationAliaser {
>>>     public class Javax {
>>>         public Enterprise getEnterprise() {return new Enterprise();}
>>>
>>>     }
>>>     public class Enterprise {
>>>         public Context getContext() {return new Context();}
>>>     }
>>>     public class Context {
>>>         public Conversation getConversation() {return conversation;}
>>>
>>>     }
>>>     @Inject
>>>     private Conversation conversation;
>>>     @Produces @ApplicationScoped @Named("javax")
>>>     public Javax javax() {return new Javax();}
>>> }
>>>
>>> But that works!
>>>
>>> Xavier
>>>
>>>
>>>
>>> From: Xavier Dury <ka...@hotmail.com>
>>> Sent: Wednesday, September 28, 2016 8:42 PM
>>> To: users@tomee.apache.org
>>> Subject: Re: OpenEJB and EL
>>>
>>> Hmmm... I guess I'll have to @Produces @Named the conversation if I want to
>>> use it in ELs. I don't know if something like
>>> #{applicationScope['javax. enterprise.context. conversation'].transient}
>>> would work?
>>>
>>> I remember back in my JSP days that, sometimes, I had to use something like
>>> ${requestScope['javax.servlet. forward.request_uri']} instead of
>>> plain ${javax.servlet.forward. request_uri}.
>>>
>>> Xavier
>>>
>>>
>>> From: Romain Manni-Bucau <rm...@gmail.com>
>>> Sent: Wednesday, September 28, 2016 6:54 PM
>>> To: users@tomee.apache.org
>>> Subject: Re: OpenEJB and EL
>>>
>>> hmm, wonder if it is linked to the value you try to evaluate (which doesn't
>>> respect EL spec even if in CDI spec - don't ask please ;)).. See
>>> https://issues.jboss.org/ browse/CDITCK-462 /
>>> http://lists.jboss.org/ pipermail/cdi-dev/2015- January/006009.html
>>>
>>>
>>>
>>>
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/ rmannibucau> |  Blog
>>>
>>>
>>>
>>> Romain Manni-Bucau (@rmannibucau) | Twitter
>>> twitter.com
>>> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
>>> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
>>> https://t.co/0VnvWwbedt . Blog ...
>>> <https://blog-rmannibucau. rhcloud.com> | Old Wordpress Blog
>>> <http://rmannibucau.wordpress. com> | Github
>>> <https://github.com/ rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/ rmannibucau> | Tomitriber
>>> <http://www.tomitribe.com> | JavaEE Factory
>>> <https://javaeefactory- rmannibucau.rhcloud.com>
>>>
>>> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>>>
>>>>  Hi Romain,
>>>>
>>>>  I tried with org.apache.tomcat:tomcat- jasper-el:8.5.5 but it does not
>>>>  parse my expression until I change ".transient" by
>>> ".isTransient()" and
>>>>  then it gives the same error: javax.el. PropertyNotFoundException:
>>>>  ELResolver cannot handle a null base Object with identifier
>>> 'javax'.
>>>>
>>>>  Does the EL context need something else than adding the
>>>>  BeanManager.getELResolver()  to be able to resolve some implicit objects? I
>>>>  don't understand why it works with ri-1.0.
>>>>
>>>>  Xavier
>>>>
>>>>
>>>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>>>  Sent: Wednesday, September 28, 2016 4:02 PM
>>>>  To: users@tomee.apache.org
>>>>  Subject: Re: OpenEJB and EL
>>>>
>>>>  Hi Xavier
>>>>
>>>>  On the phone so hard to give you a link bit try using tomcat el impl of
>>>>  tomcat 8.5
>>>>
>>>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
>>> a écrit :
>>>>
>>>>  > Hi,
>>>>  >
>>>>  > I am using OpenEJB for my tests and need support for EL expressions in
>>> my
>>>>  > own code.
>>>>  >
>>>>  > By default, if I do something like this (pay attention to the
>>>>  expression):
>>>>  >
>>>>  > ExpressionFactory factory = beanManager. wrapExpressionFactory(
>>>>  > ExpressionFactory.newInstance( ));
>>>>  > StandardELContext elContext = new StandardELContext(factory);
>>>>  > elContext.addELResolver( beanManager.getELResolver());
>>>>  > ValueExpression expression = factory.createValueExpression( elContext,
>>>>  > "#{javax.enterprise.context. conversation.transient}",
>>> Boolean.class);
>>>>  > expression.getValue(elContext) ;
>>>>  >
>>>>  > and only add org.apache.tomee:openejb-core: 7.0.1 to my project then I
>>>>  get
>>>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
>>>>  > org.apache.el. ExpressionFactoryImpl
>>>>  >
>>>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
>>>>  PropertyNotFoundException:
>>>>  > ELResolver cannot handle a null base Object with identifier
>>> 'javax'
>>>>  >
>>>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
>>> META-INF/javax.el.
>>>>  ExpressionFactory
>>>>  > < com.sun.el. ExpressionFactoryImpl) then my expression can be
>>> evaluated
>>>>  > but I can't use any new feature of 3.0 (like lambdas)
>>>>  >
>>>>  > So, either my dependencies are wrong or I am not correctly
>>> initializing
>>>>  my
>>>>  > factory.
>>>>  >
>>>>  > Does anybody have an idea?
>>>>  >
>>>>  > Thanks,
>>>>  >
>>>>  > Xavier
>>>>
>>>>
>>>
>>
>
>
>

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
a producer allows to get a shorter/more elegant naming like #{conv.id} if
you @Produces @Named("conv") ;)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 23:01 GMT+02:00 Mark Struberg <st...@yahoo.de.invalid>:

> Oh boy, sorry for you. You did hit a blank spot in the CDI spec.
>
> Problem is that the EE umbrella spec, the EL spec and the CDI spec
> contradict each other.
>
> The Weld guys solved this by introducing a Javax class. But that takes
> away the whole javax.* tree for the EL. That's just not good as it
> contradicts the EL spec.
>
> Could you please try the following
>
> @RequestScoped
> @Named("conversation")
> public class ConversationWrapper {
>    private @Inject Conversation conv;
>
>   public Conversation get() {
>        return conv;
>    }
> }
>
> And in the EL just use #{conversation.get.id}
>
> LieGrue,
> strub
>
>
>
>
> > On Wednesday, 28 September 2016, 22:12, Xavier Dury <ka...@hotmail.com>
> wrote:
> > > I really don't understand how something like <f:param
> > name="cid"
> > value="#{javax.enterprise.context.conversation.id}"/> actually
> > works... something must be made to make the EL processor accept that
> invalid
> > bean name.
> >
> > Making a producer which @Produces @Named Conversation conflicts with the
> > built-in bean from OWB (with WebBeanType.CONVERSATION)...
> >
> > ... so, I have done the following for my tests but I feel a bit ashamed
> because
> > I can't imagine there is no better solution than this ;-)
> >
> > public class ConversationAliaser {
> >     public class Javax {
> >         public Enterprise getEnterprise() {return new Enterprise();}
> >
> >     }
> >     public class Enterprise {
> >         public Context getContext() {return new Context();}
> >     }
> >     public class Context {
> >         public Conversation getConversation() {return conversation;}
> >
> >     }
> >     @Inject
> >     private Conversation conversation;
> >     @Produces @ApplicationScoped @Named("javax")
> >     public Javax javax() {return new Javax();}
> > }
> >
> > But that works!
> >
> > Xavier
> >
> >
> >
> > From: Xavier Dury <ka...@hotmail.com>
> > Sent: Wednesday, September 28, 2016 8:42 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Hmmm... I guess I'll have to @Produces @Named the conversation if I want
> to
> > use it in ELs. I don't know if something like
> > #{applicationScope['javax.enterprise.context.conversation'].transient}
> > would work?
> >
> > I remember back in my JSP days that, sometimes, I had to use something
> like
> > ${requestScope['javax.servlet.forward.request_uri']} instead of
> > plain ${javax.servlet.forward.request_uri}.
> >
> > Xavier
> >
> >
> > From: Romain Manni-Bucau <rm...@gmail.com>
> > Sent: Wednesday, September 28, 2016 6:54 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > hmm, wonder if it is linked to the value you try to evaluate (which
> doesn't
> > respect EL spec even if in CDI spec - don't ask please ;)).. See
> > https://issues.jboss.org/browse/CDITCK-462 /
> > http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html
> >
> >
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >
> >
> >
> > Romain Manni-Bucau (@rmannibucau) | Twitter
> > twitter.com
> > The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE)
> /
> > Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> > https://t.co/0VnvWwbedt . Blog ...
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> >
> >>  Hi Romain,
> >>
> >>  I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> >>  parse my expression until I change ".transient" by
> > ".isTransient()" and
> >>  then it gives the same error: javax.el.PropertyNotFoundException:
> >>  ELResolver cannot handle a null base Object with identifier
> > 'javax'.
> >>
> >>  Does the EL context need something else than adding the
> >>  BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> >>  don't understand why it works with ri-1.0.
> >>
> >>  Xavier
> >>
> >>
> >>  From: Romain Manni-Bucau <rm...@gmail.com>
> >>  Sent: Wednesday, September 28, 2016 4:02 PM
> >>  To: users@tomee.apache.org
> >>  Subject: Re: OpenEJB and EL
> >>
> >>  Hi Xavier
> >>
> >>  On the phone so hard to give you a link bit try using tomcat el impl of
> >>  tomcat 8.5
> >>
> >>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com>
> > a écrit :
> >>
> >>  > Hi,
> >>  >
> >>  > I am using OpenEJB for my tests and need support for EL expressions
> in
> > my
> >>  > own code.
> >>  >
> >>  > By default, if I do something like this (pay attention to the
> >>  expression):
> >>  >
> >>  > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> >>  > ExpressionFactory.newInstance());
> >>  > StandardELContext elContext = new StandardELContext(factory);
> >>  > elContext.addELResolver(beanManager.getELResolver());
> >>  > ValueExpression expression = factory.createValueExpression(
> elContext,
> >>  > "#{javax.enterprise.context.conversation.transient}",
> > Boolean.class);
> >>  > expression.getValue(elContext);
> >>  >
> >>  > and only add org.apache.tomee:openejb-core:7.0.1 to my project then
> I
> >>  get
> >>  > javax.el.ELException: Unable to find ExpressionFactory of type:
> >>  > org.apache.el.ExpressionFactoryImpl
> >>  >
> >>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> >>  PropertyNotFoundException:
> >>  > ELResolver cannot handle a null base Object with identifier
> > 'javax'
> >>  >
> >>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> > META-INF/javax.el.
> >>  ExpressionFactory
> >>  > < com.sun.el.ExpressionFactoryImpl) then my expression can be
> > evaluated
> >>  > but I can't use any new feature of 3.0 (like lambdas)
> >>  >
> >>  > So, either my dependencies are wrong or I am not correctly
> > initializing
> >>  my
> >>  > factory.
> >>  >
> >>  > Does anybody have an idea?
> >>  >
> >>  > Thanks,
> >>  >
> >>  > Xavier
> >>
> >>
> >
>

Re: OpenEJB and EL

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Oh boy, sorry for you. You did hit a blank spot in the CDI spec.

Problem is that the EE umbrella spec, the EL spec and the CDI spec contradict each other.

The Weld guys solved this by introducing a Javax class. But that takes away the whole javax.* tree for the EL. That's just not good as it contradicts the EL spec.

Could you please try the following

@RequestScoped
@Named("conversation")
public class ConversationWrapper {
   private @Inject Conversation conv;

  public Conversation get() {
       return conv;
   }
}

And in the EL just use #{conversation.get.id}

LieGrue,
strub




> On Wednesday, 28 September 2016, 22:12, Xavier Dury <ka...@hotmail.com> wrote:
> > I really don't understand how something like <f:param 
> name="cid" 
> value="#{javax.enterprise.context.conversation.id}"/> actually 
> works... something must be made to make the EL processor accept that invalid 
> bean name.
> 
> Making a producer which @Produces @Named Conversation conflicts with the 
> built-in bean from OWB (with WebBeanType.CONVERSATION)...
> 
> ... so, I have done the following for my tests but I feel a bit ashamed because 
> I can't imagine there is no better solution than this ;-)
> 
> public class ConversationAliaser {    
>     public class Javax {
>         public Enterprise getEnterprise() {return new Enterprise();}        
>     
>     }
>     public class Enterprise {    
>         public Context getContext() {return new Context();}
>     }
>     public class Context {            
>         public Conversation getConversation() {return conversation;}        
>     
>     }
>     @Inject
>     private Conversation conversation;
>     @Produces @ApplicationScoped @Named("javax")
>     public Javax javax() {return new Javax();}
> }
> 
> But that works!
> 
> Xavier
> 
> 
> 
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 8:42 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>    
> Hmmm... I guess I'll have to @Produces @Named the conversation if I want to 
> use it in ELs. I don't know if something like 
> #{applicationScope['javax.enterprise.context.conversation'].transient} 
> would work?
> 
> I remember back in my JSP days that, sometimes, I had to use something like 
> ${requestScope['javax.servlet.forward.request_uri']} instead of 
> plain ${javax.servlet.forward.request_uri}.
> 
> Xavier
> 
> 
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 6:54 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>     
> hmm, wonder if it is linked to the value you try to evaluate (which doesn't
> respect EL spec even if in CDI spec - don't ask please ;)).. See
> https://issues.jboss.org/browse/CDITCK-462 /
> http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html
> 
> 
> 
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> 
> 
> 
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / 
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github 
> <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 
> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
> 
>>  Hi Romain,
>> 
>>  I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
>>  parse my expression until I change ".transient" by 
> ".isTransient()" and
>>  then it gives the same error: javax.el.PropertyNotFoundException:
>>  ELResolver cannot handle a null base Object with identifier 
> 'javax'.
>> 
>>  Does the EL context need something else than adding the
>>  BeanManager.getELResolver()  to be able to resolve some implicit objects? I
>>  don't understand why it works with ri-1.0.
>> 
>>  Xavier
>> 
>> 
>>  From: Romain Manni-Bucau <rm...@gmail.com>
>>  Sent: Wednesday, September 28, 2016 4:02 PM
>>  To: users@tomee.apache.org
>>  Subject: Re: OpenEJB and EL
>> 
>>  Hi Xavier
>> 
>>  On the phone so hard to give you a link bit try using tomcat el impl of
>>  tomcat 8.5
>> 
>>  Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> 
> a écrit :
>> 
>>  > Hi,
>>  >
>>  > I am using OpenEJB for my tests and need support for EL expressions in 
> my
>>  > own code.
>>  >
>>  > By default, if I do something like this (pay attention to the
>>  expression):
>>  >
>>  > ExpressionFactory factory = beanManager.wrapExpressionFactory(
>>  > ExpressionFactory.newInstance());
>>  > StandardELContext elContext = new StandardELContext(factory);
>>  > elContext.addELResolver(beanManager.getELResolver());
>>  > ValueExpression expression = factory.createValueExpression(elContext,
>>  > "#{javax.enterprise.context.conversation.transient}", 
> Boolean.class);
>>  > expression.getValue(elContext);
>>  >
>>  > and only add org.apache.tomee:openejb-core:7.0.1 to my project then I
>>  get
>>  > javax.el.ELException: Unable to find ExpressionFactory of type:
>>  > org.apache.el.ExpressionFactoryImpl
>>  >
>>  > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
>>  PropertyNotFoundException:
>>  > ELResolver cannot handle a null base Object with identifier 
> 'javax'
>>  >
>>  > if I switch the EL library to com.sun.el:el-ri:1.0 (+ 
> META-INF/javax.el.
>>  ExpressionFactory
>>  > < com.sun.el.ExpressionFactoryImpl) then my expression can be 
> evaluated
>>  > but I can't use any new feature of 3.0 (like lambdas)
>>  >
>>  > So, either my dependencies are wrong or I am not correctly 
> initializing
>>  my
>>  > factory.
>>  >
>>  > Does anybody have an idea?
>>  >
>>  > Thanks,
>>  >
>>  > Xavier
>> 
>> 
> 

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
That was my impl of that to pass the tck when the discussion started then
reverted it (never hit a release) cause ... well you get openwebbeans
opinion in the thread I guess ;)

With tomcat you can set as system property (JVM recommanded, tomee ones can
not be enough depending how you
boot) -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true. The issue is of
course transient is a reserved keyword in java so forbidden there (see
org.apache.el.util.Validation#invalidIdentifiers and
org.apache.el.util.Validation#isIdentifier). Set to true the system
property will allow to pass the expression creation but will fail
with ELResolver cannot handle a null base Object with identifier 'javax'

Look https://gist.github.com/rmannibucau/899fc4d605f1a8395d283f6127fd2f4e
to understand how hacky it is to support it from OpenWebBeans and why we
asked to not do it to the spec (check the last else).




Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 22:11 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> I really don't understand how something like <f:param name="cid" value="#{
> javax.enterprise.context.conversation.id}"/> actually works... something
> must be made to make the EL processor accept that invalid bean name.
>
> Making a producer which @Produces @Named Conversation conflicts with the
> built-in bean from OWB (with WebBeanType.CONVERSATION)...
>
> ... so, I have done the following for my tests but I feel a bit ashamed
> because I can't imagine there is no better solution than this ;-)
>
> public class ConversationAliaser {
>         public class Javax {
>                 public Enterprise getEnterprise() {return new
> Enterprise();}
>         }
>         public class Enterprise {
>                 public Context getContext() {return new Context();}
>         }
>         public class Context {
>                 public Conversation getConversation() {return
> conversation;}
>         }
>         @Inject
>         private Conversation conversation;
>         @Produces @ApplicationScoped @Named("javax")
>         public Javax javax() {return new Javax();}
> }
>
> But that works!
>
> Xavier
>
>
> From: Xavier Dury <ka...@hotmail.com>
> Sent: Wednesday, September 28, 2016 8:42 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Hmmm... I guess I'll have to @Produces @Named the conversation if I want
> to use it in ELs. I don't know if something like #{applicationScope['javax.
> enterprise.context.conversation'].transient} would work?
>
> I remember back in my JSP days that, sometimes, I had to use something
> like ${requestScope['javax.servlet.forward.request_uri']} instead of
> plain ${javax.servlet.forward.request_uri}.
>
> Xavier
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 6:54 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> hmm, wonder if it is linked to the value you try to evaluate (which doesn't
> respect EL spec even if in CDI spec - don't ask please ;)).. See
> https://issues.jboss.org/browse/CDITCK-462 /
> http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html
>
>
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>
>
>
> Romain Manni-Bucau (@rmannibucau) | Twitter
> twitter.com
> The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) /
> Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:
> https://t.co/0VnvWwbedt . Blog ...
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:
>
> > Hi Romain,
> >
> > I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> > parse my expression until I change ".transient" by ".isTransient()" and
> > then it gives the same error: javax.el.PropertyNotFoundException:
> > ELResolver cannot handle a null base Object with identifier 'javax'.
> >
> > Does the EL context need something else than adding the
> > BeanManager.getELResolver()  to be able to resolve some implicit
> objects? I
> > don't understand why it works with ri-1.0.
> >
> > Xavier
> >
> >
> > From: Romain Manni-Bucau <rm...@gmail.com>
> > Sent: Wednesday, September 28, 2016 4:02 PM
> > To: users@tomee.apache.org
> > Subject: Re: OpenEJB and EL
> >
> > Hi Xavier
> >
> > On the phone so hard to give you a link bit try using tomcat el impl of
> > tomcat 8.5
> >
> > Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :
> >
> > > Hi,
> > >
> > > I am using OpenEJB for my tests and need support for EL expressions in
> my
> > > own code.
> > >
> > > By default, if I do something like this (pay attention to the
> > expression):
> > >
> > > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> > > ExpressionFactory.newInstance());
> > > StandardELContext elContext = new StandardELContext(factory);
> > > elContext.addELResolver(beanManager.getELResolver());
> > > ValueExpression expression = factory.createValueExpression(elContext,
> > > "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> > > expression.getValue(elContext);
> > >
> > > and only add org.apache.tomee:openejb-core:7.0.1 to my project then I
> > get
> > > javax.el.ELException: Unable to find ExpressionFactory of type:
> > > org.apache.el.ExpressionFactoryImpl
> > >
> > > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> > PropertyNotFoundException:
> > > ELResolver cannot handle a null base Object with identifier 'javax'
> > >
> > > if I switch the EL library to com.sun.el:el-ri:1.0 (+
> META-INF/javax.el.
> > ExpressionFactory
> > > < com.sun.el.ExpressionFactoryImpl) then my expression can be
> evaluated
> > > but I can't use any new feature of 3.0 (like lambdas)
> > >
> > > So, either my dependencies are wrong or I am not correctly initializing
> > my
> > > factory.
> > >
> > > Does anybody have an idea?
> > >
> > > Thanks,
> > >
> > > Xavier
> >
> >
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
I really don't understand how something like <f:param name="cid" value="#{javax.enterprise.context.conversation.id}"/> actually works... something must be made to make the EL processor accept that invalid bean name.

Making a producer which @Produces @Named Conversation conflicts with the built-in bean from OWB (with WebBeanType.CONVERSATION)...

... so, I have done the following for my tests but I feel a bit ashamed because I can't imagine there is no better solution than this ;-)

public class ConversationAliaser {	
	public class Javax {
		public Enterprise getEnterprise() {return new Enterprise();}			
	}
	public class Enterprise {	
		public Context getContext() {return new Context();}
	}
	public class Context {			
		public Conversation getConversation() {return conversation;}			
	}
	@Inject
	private Conversation conversation;
	@Produces @ApplicationScoped @Named("javax")
	public Javax javax() {return new Javax();}
}

But that works!

Xavier


From: Xavier Dury <ka...@hotmail.com>
Sent: Wednesday, September 28, 2016 8:42 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Hmmm... I guess I'll have to @Produces @Named the conversation if I want to use it in ELs. I don't know if something like #{applicationScope['javax.enterprise.context.conversation'].transient} would work?

I remember back in my JSP days that, sometimes, I had to use something like ${requestScope['javax.servlet.forward.request_uri']} instead of plain ${javax.servlet.forward.request_uri}.

Xavier


From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 6:54 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
hmm, wonder if it is linked to the value you try to evaluate (which doesn't
respect EL spec even if in CDI spec - don't ask please ;)).. See
https://issues.jboss.org/browse/CDITCK-462 /
http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html




Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory:  https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Hi Romain,
>
> I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> parse my expression until I change ".transient" by ".isTransient()" and
> then it gives the same error: javax.el.PropertyNotFoundException:
> ELResolver cannot handle a null base Object with identifier 'javax'.
>
> Does the EL context need something else than adding the
> BeanManager.getELResolver()  to be able to resolve some implicit objects? I
> don't understand why it works with ri-1.0.
>
> Xavier
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 4:02 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Hi Xavier
>
> On the phone so hard to give you a link bit try using tomcat el impl of
> tomcat 8.5
>
> Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :
>
> > Hi,
> >
> > I am using OpenEJB for my tests and need support for EL expressions in my
> > own code.
> >
> > By default, if I do something like this (pay attention to the
> expression):
> >
> > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> > ExpressionFactory.newInstance());
> > StandardELContext elContext = new StandardELContext(factory);
> > elContext.addELResolver(beanManager.getELResolver());
> > ValueExpression expression = factory.createValueExpression(elContext,
> > "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> > expression.getValue(elContext);
> >
> > and only add org.apache.tomee:openejb-core:7.0.1 to my project then I
> get
> > javax.el.ELException: Unable to find ExpressionFactory of type:
> > org.apache.el.ExpressionFactoryImpl
> >
> > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> PropertyNotFoundException:
> > ELResolver cannot handle a null base Object with identifier 'javax'
> >
> > if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.
> ExpressionFactory
> > < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated
> > but I can't use any new feature of 3.0 (like lambdas)
> >
> > So, either my dependencies are wrong or I am not correctly initializing
> my
> > factory.
> >
> > Does anybody have an idea?
> >
> > Thanks,
> >
> > Xavier
>
>
        

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Hmmm... I guess I'll have to @Produces @Named the conversation if I want to use it in ELs. I don't know if something like #{applicationScope['javax.enterprise.context.conversation'].transient} would work?

I remember back in my JSP days that, sometimes, I had to use something like ${requestScope['javax.servlet.forward.request_uri']} instead of plain ${javax.servlet.forward.request_uri}.

Xavier


From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 6:54 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
hmm, wonder if it is linked to the value you try to evaluate (which doesn't
respect EL spec even if in CDI spec - don't ask please ;)).. See
https://issues.jboss.org/browse/CDITCK-462 /
http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html




Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog



Romain Manni-Bucau (@rmannibucau) | Twitter
twitter.com
The latest Tweets from Romain Manni-Bucau (@rmannibucau). ASF / Java(EE) / Angular. LinkedIn: https://t.co/dX7XMGjbBi. JavaEE Factory: https://t.co/0VnvWwbedt . Blog ...
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Hi Romain,
>
> I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> parse my expression until I change ".transient" by ".isTransient()" and
> then it gives the same error: javax.el.PropertyNotFoundException:
> ELResolver cannot handle a null base Object with identifier 'javax'.
>
> Does the EL context need something else than adding the
> BeanManager.getELResolver()  to be able to resolve some implicit objects? I
> don't understand why it works with ri-1.0.
>
> Xavier
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 4:02 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Hi Xavier
>
> On the phone so hard to give you a link bit try using tomcat el impl of
> tomcat 8.5
>
> Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :
>
> > Hi,
> >
> > I am using OpenEJB for my tests and need support for EL expressions in my
> > own code.
> >
> > By default, if I do something like this (pay attention to the
> expression):
> >
> > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> > ExpressionFactory.newInstance());
> > StandardELContext elContext = new StandardELContext(factory);
> > elContext.addELResolver(beanManager.getELResolver());
> > ValueExpression expression = factory.createValueExpression(elContext,
> > "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> > expression.getValue(elContext);
> >
> > and only add org.apache.tomee:openejb-core:7.0.1 to my project then I
> get
> > javax.el.ELException: Unable to find ExpressionFactory of type:
> > org.apache.el.ExpressionFactoryImpl
> >
> > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> PropertyNotFoundException:
> > ELResolver cannot handle a null base Object with identifier 'javax'
> >
> > if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.
> ExpressionFactory
> > < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated
> > but I can't use any new feature of 3.0 (like lambdas)
> >
> > So, either my dependencies are wrong or I am not correctly initializing
> my
> > factory.
> >
> > Does anybody have an idea?
> >
> > Thanks,
> >
> > Xavier
>
>
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hmm, wonder if it is linked to the value you try to evaluate (which doesn't
respect EL spec even if in CDI spec - don't ask please ;)).. See
https://issues.jboss.org/browse/CDITCK-462 /
http://lists.jboss.org/pipermail/cdi-dev/2015-January/006009.html




Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-09-28 18:17 GMT+02:00 Xavier Dury <ka...@hotmail.com>:

> Hi Romain,
>
> I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not
> parse my expression until I change ".transient" by ".isTransient()" and
> then it gives the same error: javax.el.PropertyNotFoundException:
> ELResolver cannot handle a null base Object with identifier 'javax'.
>
> Does the EL context need something else than adding the
> BeanManager.getELResolver()  to be able to resolve some implicit objects? I
> don't understand why it works with ri-1.0.
>
> Xavier
>
>
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Wednesday, September 28, 2016 4:02 PM
> To: users@tomee.apache.org
> Subject: Re: OpenEJB and EL
>
> Hi Xavier
>
> On the phone so hard to give you a link bit try using tomcat el impl of
> tomcat 8.5
>
> Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :
>
> > Hi,
> >
> > I am using OpenEJB for my tests and need support for EL expressions in my
> > own code.
> >
> > By default, if I do something like this (pay attention to the
> expression):
> >
> > ExpressionFactory factory = beanManager.wrapExpressionFactory(
> > ExpressionFactory.newInstance());
> > StandardELContext elContext = new StandardELContext(factory);
> > elContext.addELResolver(beanManager.getELResolver());
> > ValueExpression expression = factory.createValueExpression(elContext,
> > "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> > expression.getValue(elContext);
> >
> > and only add org.apache.tomee:openejb-core:7.0.1 to my project then I
> get
> > javax.el.ELException: Unable to find ExpressionFactory of type:
> > org.apache.el.ExpressionFactoryImpl
> >
> > if I add org.glassfish:javax.el:3.0.0 then I get javax.el.
> PropertyNotFoundException:
> > ELResolver cannot handle a null base Object with identifier 'javax'
> >
> > if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.
> ExpressionFactory
> > < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated
> > but I can't use any new feature of 3.0 (like lambdas)
> >
> > So, either my dependencies are wrong or I am not correctly initializing
> my
> > factory.
> >
> > Does anybody have an idea?
> >
> > Thanks,
> >
> > Xavier
>
>

Re: OpenEJB and EL

Posted by Xavier Dury <ka...@hotmail.com>.
Hi Romain,

I tried with org.apache.tomcat:tomcat-jasper-el:8.5.5 but it does not parse my expression until I change ".transient" by ".isTransient()" and then it gives the same error: javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'javax'.

Does the EL context need something else than adding the BeanManager.getELResolver()  to be able to resolve some implicit objects? I don't understand why it works with ri-1.0.

Xavier


From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Wednesday, September 28, 2016 4:02 PM
To: users@tomee.apache.org
Subject: Re: OpenEJB and EL
    
Hi Xavier

On the phone so hard to give you a link bit try using tomcat el impl of
tomcat 8.5

Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :

> Hi,
>
> I am using OpenEJB for my tests and need support for EL expressions in my
> own code.
>
> By default, if I do something like this (pay attention to the expression):
>
> ExpressionFactory factory = beanManager.wrapExpressionFactory(
> ExpressionFactory.newInstance());
> StandardELContext elContext = new StandardELContext(factory);
> elContext.addELResolver(beanManager.getELResolver());
> ValueExpression expression = factory.createValueExpression(elContext,
> "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> expression.getValue(elContext);
>
> and only add org.apache.tomee:openejb-core:7.0.1 to my project then I get
> javax.el.ELException: Unable to find ExpressionFactory of type:
> org.apache.el.ExpressionFactoryImpl
>
> if I add org.glassfish:javax.el:3.0.0 then I get javax.el.PropertyNotFoundException:
> ELResolver cannot handle a null base Object with identifier 'javax'
>
> if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.ExpressionFactory
> < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated
> but I can't use any new feature of 3.0 (like lambdas)
>
> So, either my dependencies are wrong or I am not correctly initializing my
> factory.
>
> Does anybody have an idea?
>
> Thanks,
>
> Xavier
    

Re: OpenEJB and EL

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Xavier

On the phone so hard to give you a link bit try using tomcat el impl of
tomcat 8.5

Le 28 sept. 2016 15:29, "Xavier Dury" <ka...@hotmail.com> a écrit :

> Hi,
>
> I am using OpenEJB for my tests and need support for EL expressions in my
> own code.
>
> By default, if I do something like this (pay attention to the expression):
>
> ExpressionFactory factory = beanManager.wrapExpressionFactory(
> ExpressionFactory.newInstance());
> StandardELContext elContext = new StandardELContext(factory);
> elContext.addELResolver(beanManager.getELResolver());
> ValueExpression expression = factory.createValueExpression(elContext,
> "#{javax.enterprise.context.conversation.transient}", Boolean.class);
> expression.getValue(elContext);
>
> and only add org.apache.tomee:openejb-core:7.0.1 to my project then I get
> javax.el.ELException: Unable to find ExpressionFactory of type:
> org.apache.el.ExpressionFactoryImpl
>
> if I add org.glassfish:javax.el:3.0.0 then I get javax.el.PropertyNotFoundException:
> ELResolver cannot handle a null base Object with identifier 'javax'
>
> if I switch the EL library to com.sun.el:el-ri:1.0 (+ META-INF/javax.el.ExpressionFactory
> < com.sun.el.ExpressionFactoryImpl) then my expression can be evaluated
> but I can't use any new feature of 3.0 (like lambdas)
>
> So, either my dependencies are wrong or I am not correctly initializing my
> factory.
>
> Does anybody have an idea?
>
> Thanks,
>
> Xavier