You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Scott Kurz <sc...@gmail.com> on 2011/01/04 21:09:59 UTC

Re: SCA Callback NPE

Hi Thiago,

I think your immediate problem would go away if you remove the
@EagerInit from the ServerImpl component impl.

It looks like our code injecting the callback proxy assumes it's on an
invocation path, while the @EagerInit causes this to be injected when
the ServerImpl component starts.

As far as whether this should be fixed or not.. I haven't given this
much thought, so would suggest you open a JIRA if you want to pursue
further.

Thanks,
Scott

Re: SCA Callback NPE

Posted by Thiago Souza <tc...@gmail.com>.
Hi Simon,

             Thanks for your feedback, I'll check this.

Best Regards

On Tue, Jan 4, 2011 at 19:59, Simon Nash <na...@apache.org> wrote:

> Scott Kurz wrote:
>
>> Hi Thiago,
>>
>> I think your immediate problem would go away if you remove the
>> @EagerInit from the ServerImpl component impl.
>>
>> It looks like our code injecting the callback proxy assumes it's on an
>> invocation path, while the @EagerInit causes this to be injected when
>> the ServerImpl component starts.
>>
>> As far as whether this should be fixed or not.. I haven't given this
>> much thought, so would suggest you open a JIRA if you want to pursue
>> further.
>>
>> Thanks,
>> Scott
>>
>>
>>  The SCA 1.1 specs prohibit using callback injection with a COMPOSITE
> scoped component.  Instead, the SCA APIs must be used to obtain the
> callback reference.  Tuscany should raise an error in this case, and
> it would be good to have a JIRA to track this.
>
>  Simon
>
>

Re: SCA Callback NPE

Posted by Mike Edwards <mi...@gmail.com>.
On 04/01/2011 21:59, Simon Nash wrote:
> The SCA 1.1 specs prohibit using callback injection with a COMPOSITE
> scoped component. Instead, the SCA APIs must be used to obtain the
> callback reference. Tuscany should raise an error in this case, and
> it would be good to have a JIRA to track this.
>
> Simon
>

Not only do the OASIS V1.1 specs outlaw using @Callback on a Field or Method of a Java 
implementation class which is annotated with @Scope(COMPOSITE), but there is even an OASIS 
compliance test for this too.

Turns out that Tuscany fails the compliance test :-(

I've raised a JIRA:

https://issues.apache.org/jira/browse/TUSCANY-3813

I've also done a fix and uploaded it to the latest Trunk...


The basic message here is:

IF you use Scope(COMPOSITE) on your class - you CAN'T use @Callback on a Field or on a Method to get 
a Callback object injected.  You must use the RequestContext API that SCA provides - see Section 
7.2.5 of the SCA Java Common Annotations & APIs spec:

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec-csd05.html
http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec-csd05.pdf

The reason for this is that a COMPOSITE scope component can handle multiple requests (perhaps 
simultaneously) and so it is not practicable to inject a single Callback object into that component, 
since each service request will have its own Callback object.


Yours,  Mike.

Re: SCA Callback NPE

Posted by Simon Nash <na...@apache.org>.
Scott Kurz wrote:
> Hi Thiago,
> 
> I think your immediate problem would go away if you remove the
> @EagerInit from the ServerImpl component impl.
> 
> It looks like our code injecting the callback proxy assumes it's on an
> invocation path, while the @EagerInit causes this to be injected when
> the ServerImpl component starts.
> 
> As far as whether this should be fixed or not.. I haven't given this
> much thought, so would suggest you open a JIRA if you want to pursue
> further.
> 
> Thanks,
> Scott
> 
> 
The SCA 1.1 specs prohibit using callback injection with a COMPOSITE
scoped component.  Instead, the SCA APIs must be used to obtain the
callback reference.  Tuscany should raise an error in this case, and
it would be good to have a JIRA to track this.

   Simon