You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Ka...@t-systems.com on 2008/06/27 16:24:40 UTC

EJBContext cannot be injected in 3.1-SNAPSHOT

Hi,

I can inject the session context successfully with:

    @Resource
    private SessionContext ctx;

But when I only what to have the EJBContext

    @Resource
    private EJBContext ctx;

it cannot be injected.

Is this intended? Well, SessionContext is fine, but I was wondering why
the super interface cannot be injected.

Regards,
Karsten

Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by Karsten Ohme <wi...@t-online.de>.
David Blevins schrieb:
> 
> On Jul 19, 2008, at 9:26 AM, Karsten Ohme wrote:
> 
>> Sorry,
>>
>> was on holidays. Should I still fill in a Jira issue to keep track of it?
> 
> Sure, but file it as an improvement as it's definitely not a bug.
> 
> Hope you had a great holiday :)

Yes, thanks. But too short. Holidays under 365 d/y are not satisfying.

I created an issue:

https://issues.apache.org/jira/browse/OPENEJB-863

I was not sure about some details, so adjust if necessary:

Component/s:	container system
Affects Version/s:	None
Fix Version/s:	None

Karsten

> 
> -David
> 
>>
>>
>> Regards,
>> Karsten
>>> On Fri, Jun 27, 2008 at 10:33 PM, David Blevins 
>>> <da...@visi.com> wrote:
>>>> In general, we don't check isAssignable on injection types, 
>>>> primarily cause
>>>> it gets very hairy around business interfaces.  But we could probably
>>>> support this particular use case.
>>> I think we have to as 16.15 EJBContext References is pretty clear on it:
>>> The container must make a component's EJBContext interface available
>>> either through injection using the Resource annotation or in JNDI
>>> under the name java:comp/EJBContext. The authenticationType and
>>> shareable elements of the Resource annotation must not be specified.
>>> and further on:
>>> The Bean Provider is responsible for requesting injection of an
>>> EJBContext object using a Resource annotation or using the defined
>>> name to lookup the EJBContext object.
>>> and finally:
>>> The Container Provider is responsible for providing an appropriate
>>> EJBContext object to the referencing component. The object returned
>>> must be of the appropriate specific type for the bean requesting
>>> injection or performing the lookup—that is, the container provider
>>> must return an instance of the SessionContext interface to referencing
>>> session beans and an instance of the MessageDrivenContext interface to
>>> message-driven beans.
>>> Karsten, would be willing to file a jira issue?
>>> Jacek
>>
>>
> 
> 
> 


Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by David Blevins <da...@visi.com>.
On Jul 19, 2008, at 9:26 AM, Karsten Ohme wrote:

> Sorry,
>
> was on holidays. Should I still fill in a Jira issue to keep track  
> of it?

Sure, but file it as an improvement as it's definitely not a bug.

Hope you had a great holiday :)

-David

>
>
> Regards,
> Karsten
>> On Fri, Jun 27, 2008 at 10:33 PM, David Blevins <david.blevins@visi.com 
>> > wrote:
>>> In general, we don't check isAssignable on injection types,  
>>> primarily cause
>>> it gets very hairy around business interfaces.  But we could  
>>> probably
>>> support this particular use case.
>> I think we have to as 16.15 EJBContext References is pretty clear  
>> on it:
>> The container must make a component's EJBContext interface available
>> either through injection using the Resource annotation or in JNDI
>> under the name java:comp/EJBContext. The authenticationType and
>> shareable elements of the Resource annotation must not be specified.
>> and further on:
>> The Bean Provider is responsible for requesting injection of an
>> EJBContext object using a Resource annotation or using the defined
>> name to lookup the EJBContext object.
>> and finally:
>> The Container Provider is responsible for providing an appropriate
>> EJBContext object to the referencing component. The object returned
>> must be of the appropriate specific type for the bean requesting
>> injection or performing the lookup—that is, the container provider
>> must return an instance of the SessionContext interface to  
>> referencing
>> session beans and an instance of the MessageDrivenContext interface  
>> to
>> message-driven beans.
>> Karsten, would be willing to file a jira issue?
>> Jacek
>
>


Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by Karsten Ohme <wi...@t-online.de>.
Sorry,

was on holidays. Should I still fill in a Jira issue to keep track of it?

Regards,
Karsten
> On Fri, Jun 27, 2008 at 10:33 PM, David Blevins <da...@visi.com> wrote:
> 
>> In general, we don't check isAssignable on injection types, primarily cause
>> it gets very hairy around business interfaces.  But we could probably
>> support this particular use case.
> 
> I think we have to as 16.15 EJBContext References is pretty clear on it:
> 
> The container must make a component's EJBContext interface available
> either through injection using the Resource annotation or in JNDI
> under the name java:comp/EJBContext. The authenticationType and
> shareable elements of the Resource annotation must not be specified.
> 
> and further on:
> 
> The Bean Provider is responsible for requesting injection of an
> EJBContext object using a Resource annotation or using the defined
> name to lookup the EJBContext object.
> 
> and finally:
> 
> The Container Provider is responsible for providing an appropriate
> EJBContext object to the referencing component. The object returned
> must be of the appropriate specific type for the bean requesting
> injection or performing the lookup—that is, the container provider
> must return an instance of the SessionContext interface to referencing
> session beans and an instance of the MessageDrivenContext interface to
> message-driven beans.
> 
> Karsten, would be willing to file a jira issue?
> 
> Jacek
> 


Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by David Blevins <da...@visi.com>.
On Jul 5, 2008, at 2:06 PM, Jacek Laskowski wrote:

> On Fri, Jun 27, 2008 at 10:33 PM, David Blevins <david.blevins@visi.com 
> > wrote:
>
>> In general, we don't check isAssignable on injection types,  
>> primarily cause
>> it gets very hairy around business interfaces.  But we could probably
>> support this particular use case.
>
> I think we have to as 16.15 EJBContext References is pretty clear on  
> it:
>
> The container must make a component's EJBContext interface available
> either through injection using the Resource annotation or in JNDI
> under the name java:comp/EJBContext. The authenticationType and
> shareable elements of the Resource annotation must not be specified.
>
> and further on:
>
> The Bean Provider is responsible for requesting injection of an
> EJBContext object using a Resource annotation or using the defined
> name to lookup the EJBContext object.
>
> and finally:
>
> The Container Provider is responsible for providing an appropriate
> EJBContext object to the referencing component. The object returned
> must be of the appropriate specific type for the bean requesting
> injection or performing the lookup—that is, the container provider
> must return an instance of the SessionContext interface to referencing
> session beans and an instance of the MessageDrivenContext interface to
> message-driven beans.

When the spec says "a component's EJBContext interface" or "an  
appropriate EJBContext" it's referring to SessionContext,  
MessageDrivenContext or EntityContext specifically.  It isn't a  
requirement that @Resource EJBContext be injectable, but we can  
certainly support it as a feature.

-David


Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Fri, Jun 27, 2008 at 10:33 PM, David Blevins <da...@visi.com> wrote:

> In general, we don't check isAssignable on injection types, primarily cause
> it gets very hairy around business interfaces.  But we could probably
> support this particular use case.

I think we have to as 16.15 EJBContext References is pretty clear on it:

The container must make a component's EJBContext interface available
either through injection using the Resource annotation or in JNDI
under the name java:comp/EJBContext. The authenticationType and
shareable elements of the Resource annotation must not be specified.

and further on:

The Bean Provider is responsible for requesting injection of an
EJBContext object using a Resource annotation or using the defined
name to lookup the EJBContext object.

and finally:

The Container Provider is responsible for providing an appropriate
EJBContext object to the referencing component. The object returned
must be of the appropriate specific type for the bean requesting
injection or performing the lookup—that is, the container provider
must return an instance of the SessionContext interface to referencing
session beans and an instance of the MessageDrivenContext interface to
message-driven beans.

Karsten, would be willing to file a jira issue?

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl

Re: EJBContext cannot be injected in 3.1-SNAPSHOT

Posted by David Blevins <da...@visi.com>.
On Jun 27, 2008, at 7:24 AM, <Ka...@t-systems.com> <Karsten.Ohme@t-systems.com 
 > wrote:

> Hi,
>
> I can inject the session context successfully with:
>
>    @Resource
>    private SessionContext ctx;
>
> But when I only what to have the EJBContext
>
>    @Resource
>    private EJBContext ctx;
>
> it cannot be injected.
>
> Is this intended? Well, SessionContext is fine, but I was wondering  
> why
> the super interface cannot be injected.

In general, we don't check isAssignable on injection types, primarily  
cause it gets very hairy around business interfaces.  But we could  
probably support this particular use case.

-David