You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Harald Wellmann <hw...@gmail.com> on 2012/11/13 16:00:18 UTC

Bean types of EJBs with generic business interface

What are the CDI bean types of the following EJB:

@Stateless
public class CalculatorImpl implements Calculator<Integer>
{

    @Override
    public Integer add( Integer op1, Integer op2 )
    {
        return op1 + op2;
    }
}

public interface Calculator<T extends Number>
{
   T add(T op1, T op2);
}


Which of the following injection points can be satisfied with this bean:

a) @Inject Calculator<Integer> calculator;
b) @Inject Calculator calculator;


With GlassFish 3.1.2.2/Weld 1.1.8, both a) and b) resolve without problems.

With TomEE 1.5.1-SNAPSHOT/OWB 1.1.6, only b) resolves, and a) causes
the following messages:

15:50:54.776 [main] DEBUG o.a.w.container.InjectionResolver - Adding
resolved beans with key
[BeanCacheKey{type=org.ops4j.pax.exam.regression.javaee.ejb.Calculator<java.lang.Integer>,
path='null', qualifiers=@javax.enterprise.inject.Default(),
hashCode=-813701363}] to cache.
15:50:54.781 [main] ERROR unknown.jul.logger - CDI Beans module
deployment failed
javax.enterprise.inject.UnsatisfiedResolutionException: Api type
[org.ops4j.pax.exam.regression.javaee.ejb.Calculator] is not found
with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name :  calculator,
Bean Owner : [CalculatorClient, Name:null, WebBeans Type:MANAGED, API
Types:[org.ops4j.pax.exam.regression.javaee.ejb.CalculatorClient,java.lang.Object],
Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]

I'm not quite sure what the expected behaviour according to the CDI
spec should be. And assuming for the moment that GlassFish is correct,
I don't really know if this is an issue in OWB or TomEE or maybe
both...

Any explanations most welcome...

Best regards,
Harald

Re: Bean types of EJBs with generic business interface

Posted by Romain Manni-Bucau <rm...@gmail.com>.
opened https://issues.apache.org/jira/browse/OWB-720

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/11/13 Romain Manni-Bucau <rm...@gmail.com>

> Hi,
>
> think it is in Injectionresolver of OWB, will check it
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
>
> 2012/11/13 Harald Wellmann <hw...@gmail.com>
>
>> What are the CDI bean types of the following EJB:
>>
>> @Stateless
>> public class CalculatorImpl implements Calculator<Integer>
>> {
>>
>>     @Override
>>     public Integer add( Integer op1, Integer op2 )
>>     {
>>         return op1 + op2;
>>     }
>> }
>>
>> public interface Calculator<T extends Number>
>> {
>>    T add(T op1, T op2);
>> }
>>
>>
>> Which of the following injection points can be satisfied with this bean:
>>
>> a) @Inject Calculator<Integer> calculator;
>> b) @Inject Calculator calculator;
>>
>>
>> With GlassFish 3.1.2.2/Weld 1.1.8, both a) and b) resolve without
>> problems.
>>
>> With TomEE 1.5.1-SNAPSHOT/OWB 1.1.6, only b) resolves, and a) causes
>> the following messages:
>>
>> 15:50:54.776 [main] DEBUG o.a.w.container.InjectionResolver - Adding
>> resolved beans with key
>>
>> [BeanCacheKey{type=org.ops4j.pax.exam.regression.javaee.ejb.Calculator<java.lang.Integer>,
>> path='null', qualifiers=@javax.enterprise.inject.Default(),
>> hashCode=-813701363}] to cache.
>> 15:50:54.781 [main] ERROR unknown.jul.logger - CDI Beans module
>> deployment failed
>> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
>> [org.ops4j.pax.exam.regression.javaee.ejb.Calculator] is not found
>> with the qualifiers
>> Qualifiers: [@javax.enterprise.inject.Default()]
>> for injection into Field Injection Point, field name :  calculator,
>> Bean Owner : [CalculatorClient, Name:null, WebBeans Type:MANAGED, API
>>
>> Types:[org.ops4j.pax.exam.regression.javaee.ejb.CalculatorClient,java.lang.Object],
>> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
>>
>> I'm not quite sure what the expected behaviour according to the CDI
>> spec should be. And assuming for the moment that GlassFish is correct,
>> I don't really know if this is an issue in OWB or TomEE or maybe
>> both...
>>
>> Any explanations most welcome...
>>
>> Best regards,
>> Harald
>>
>
>

Re: Bean types of EJBs with generic business interface

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

think it is in Injectionresolver of OWB, will check it

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/11/13 Harald Wellmann <hw...@gmail.com>

> What are the CDI bean types of the following EJB:
>
> @Stateless
> public class CalculatorImpl implements Calculator<Integer>
> {
>
>     @Override
>     public Integer add( Integer op1, Integer op2 )
>     {
>         return op1 + op2;
>     }
> }
>
> public interface Calculator<T extends Number>
> {
>    T add(T op1, T op2);
> }
>
>
> Which of the following injection points can be satisfied with this bean:
>
> a) @Inject Calculator<Integer> calculator;
> b) @Inject Calculator calculator;
>
>
> With GlassFish 3.1.2.2/Weld 1.1.8, both a) and b) resolve without
> problems.
>
> With TomEE 1.5.1-SNAPSHOT/OWB 1.1.6, only b) resolves, and a) causes
> the following messages:
>
> 15:50:54.776 [main] DEBUG o.a.w.container.InjectionResolver - Adding
> resolved beans with key
>
> [BeanCacheKey{type=org.ops4j.pax.exam.regression.javaee.ejb.Calculator<java.lang.Integer>,
> path='null', qualifiers=@javax.enterprise.inject.Default(),
> hashCode=-813701363}] to cache.
> 15:50:54.781 [main] ERROR unknown.jul.logger - CDI Beans module
> deployment failed
> javax.enterprise.inject.UnsatisfiedResolutionException: Api type
> [org.ops4j.pax.exam.regression.javaee.ejb.Calculator] is not found
> with the qualifiers
> Qualifiers: [@javax.enterprise.inject.Default()]
> for injection into Field Injection Point, field name :  calculator,
> Bean Owner : [CalculatorClient, Name:null, WebBeans Type:MANAGED, API
>
> Types:[org.ops4j.pax.exam.regression.javaee.ejb.CalculatorClient,java.lang.Object],
> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
>
> I'm not quite sure what the expected behaviour according to the CDI
> spec should be. And assuming for the moment that GlassFish is correct,
> I don't really know if this is an issue in OWB or TomEE or maybe
> both...
>
> Any explanations most welcome...
>
> Best regards,
> Harald
>