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 Thu, 19 May 2016 10:23:14 GMT
awesome! And noted we should enhance debugging path.

Side note: if you use tomee maven plugin: mvn [package] tomee:debug works
the same way.


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-19 12:10 GMT+02:00 Emmanuel Touzery <emmanuel.touzery@lecip-its.com>
:

> and I fixed the issue. The debugger helped, thank you.
> I didn't realize BeanHelper came from our company here. It was a mistake
> in that class and the class it passed to BeanManager.
>
> Anyway, thank you again for the help!
>
> Emmanuel
>
>
> On 19/05/16 11:47, Emmanuel Touzery wrote:
>
>> Hello,
>>
>>     thank you that worked!
>>
>>     I just had to add "jpda" as a command line parameter, eg "catalina.sh
>> jpda run".
>>
>>     Will try to help myself with the debugger to get it now. Will report
>> on my success (or lack thereof).
>>
>>     Thank you again,
>>
>> Emmanuel
>>
>> On 19/05/16 11:19, Romain Manni-Bucau wrote:
>>
>>> if you use maven add in your pom with provided scope
>>> "org.apache.openejb:tomee-catalina:${version}" then in the shell you use
>>> to
>>> run tomee (i use UNIx commands but replace "sh" by "bat" and "export" by
>>> "set" for windows):
>>>
>>> export JPDA_ADDRESS=5005
>>> export JPDA_SUSPEND=y
>>> # bin\catalina.bat run for win
>>> ./bin/catalina.sh run
>>>
>>> then in your IDE just remote debug on port 5005.
>>>
>>>
>>>
>>>
>>> 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-19 11:17 GMT+02:00 Emmanuel Touzery <
>>> emmanuel.touzery@lecip-its.com>
>>> :
>>>
>>> setting up the environment so that I could debug tomee code doesn't seem
>>>> easy at all :-(
>>>> gave it a try and failed so far. I guess there's no tutorial related to
>>>> that that I could look at?
>>>>
>>>> Regards,
>>>>
>>>> Emmanuel
>>>>
>>>> On 19/05/16 09:55, Romain Manni-Bucau wrote:
>>>>
>>>> Maybe a lazy solution but very efficient: put a breakpoint in
>>>>> BeanManagerImpl
>>>>> line 703 and check what triggered the exception (should be a if at that
>>>>> point so should be easy to identify).
>>>>>
>>>>> I didn't say it was not a tomee/OWB bug - we got some in this area when
>>>>> implementing CDI 1.2 for TomEE 7 so can be an old issue fixed in
>>>>> between.
>>>>>
>>>>>
>>>>> 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-19 9:46 GMT+02:00 Emmanuel Touzery <
>>>>> emmanuel.touzery@lecip-its.com>:
>>>>>
>>>>> Hello,
>>>>>
>>>>>>       yes I didn't expect a TomEE bug, but I'm wondering what could
>>>>>> cause
>>>>>> this behaviour. This is TomEE 1.7.2 but we're also doing this in
>>>>>> another
>>>>>> 1.7.2 project, so it's not about the version I think. Maybe some
stray
>>>>>> dependency? The beans.xml, the dependencies look OK. Anywhere else
I
>>>>>> should
>>>>>> look?
>>>>>>
>>>>>>       Regards,
>>>>>>
>>>>>> Emmanuel
>>>>>>
>>>>>> On 18/05/16 15:21, Romain Manni-Bucau wrote:
>>>>>>
>>>>>> 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