tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: org.apache.webbeans.component.ProducerMethodBean is not applicable for the bean instance : String
Date Wed, 18 May 2016 13:21:59 GMT
Hi Emmanuel,

either you use an old version or something else is making it failing, this
test passes:
https://gist.github.com/rmannibucau/1d026806a6bb9b89a957c6fba50e4d46


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  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-05-18 13:42 GMT+02:00 Emmanuel Touzery <emmanuel.touzery@lecip-its.com>
:

> Hello,
>
>     I'm porting a Glassfish application to TomEE and I don't understand
> this error that I'm getting:
>
> org.apache.openejb.core.transaction.EjbTransactionUtil
> handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: Given bean type : class
> org.apache.webbeans.component.ProducerMethodBean is not applicable for the
> bean instance : String, Name:loggedInAppUserUsername, WebBeans
> Type:PRODUCERMETHOD, API
> Types:[java.lang.Comparable<String>,java.lang.Object,java.lang.CharSequence,java.lang.String,java.io.Serializable],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named]
> java.lang.IllegalArgumentException: Given bean type : class
> org.apache.webbeans.component.ProducerMethodBean is not applicable for the
> bean instance : String, Name:loggedInAppUserUsername, WebBeans
> Type:PRODUCERMETHOD, API
> Types:[java.lang.Comparable<String>,java.lang.Object,java.lang.CharSequence,java.lang.String,java.io.Serializable],
> Qualifiers:[javax.enterprise.inject.Default,javax.enterprise.inject.Any,javax.inject.Named]
>     at
> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:703)
>     at
> com.lecip.tms.tms_core.application.BeanHelper.getBeanByName(BeanHelper.java:40)
>
> I'm having this pretty trivial bean:
>
>
> public class AppUserUsernameProvider {
>
>     public static final String LOGGED_IN_USERNAME =
> "loggedInAppUserUsername";
>     @Inject
>     CurrentAppUserContext mAppUserContext;
>
>     @Produces
>     //this bean will be looked up by this id
>     @Named(LOGGED_IN_USERNAME)
>     public String getUsername() {
>         return mAppUserContext.getUsername();
>     }
> }
>
> And then I'm trying to use it like that:
>
>         String username =
> BeanHelper.getBeanByName(AppUserUsernameProvider.LOGGED_IN_USERNAME,
> String.class);
>
> And it fails on the getBeanByName() call with the stack I pasted. Not sure
> what's going on?
>
> Thank you!
>
> Emmanuel
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message