Hi Phil,

After seeing your issue, first I like to clarify few question raised in this
thread.....

Does tuscany create a new spring context for each component?
Yes, tuscany creates a new spring context for each <implementation.spring
location="xxx"/> element defined in the .composite file and each of this
spring context is independent in nature and there
are not aware of the existence of others.

What is SCAParentApplicationContext and GenericApplicationContext?
As Simon said, the SCAParentApplicationContext reads all the <sca:services/>
and <sca:reference/> elements from the spring context file and creates
appropriate bean instances, which then acts as a parent application context
for GenericApplicationContext which loads the actual spring beans. So
logically they both act as a single application context.

How to load multiple context files in Tuscany?
As of now, we dont have the option to do so from the .composite file,
however its possible to do so using the <import/> element in the spring
context files as how you are already doing for applicationContext-common.xml
and applicationContext.xml as seen in your example.

Looking at the stack trace error message, its looks like the exception is
seen at runtime while the host.webapp tries to create a SCADomain. I believe
the spring configuration files that you are using is perfectly fine and
there seems to be no issues.

1. Like to know if you are using any annotations of type
"org.osoa.sca.annotations.*" in your beans.
2. Like to know if your spring configurations files (using <import/>) as
shown in the thread, works fine without any <sca:services/> OR
<sca:reference/> elements outside of Tuscany. I believe you tried an
<import/> option to make it work with Tuscany.

The best thing for us to do is to set up a test case that replicates what
you need to do, as we have not tried to the load spring context files via
web.xml before.



On Mon, Jan 26, 2009 at 8:19 PM, Sykes, Phil <[email protected]>wrote:

>  Here is some more information.  I continued down the path of trying to
> import my other spring configuration in to the component's spring config
> file.  I basically added one bean at a time until it failed.  What is
> happening is that there is a NullPointerException being thrown that is
> getting eaten up in the SCADomain class.  In my case it happens as soon as I
> add  <tx:annotation-driven /> to my configuration.  However, I discovered
> that the same  null pointer occurs if there is an unsatisfied dependency in
> the spring config.  In other words, if you have one bean that defines a
> reference to another bean and the second bean does not exist in the
> configuration.  If using Spring by itself you would receive an exception
> indicating what the problem is.  Here it appears that the real problem is
> being suppressed.  In the case I described above there are no unsatisfied
> dependencies so the problem is caused by something else.  Below, Simon said
> that SCAParentApplicationContext should already hold the existing Spring
> configuration.  However, this does not appear to be the case.  In fact, the
> javadoc says the following:
>
>
>
> "The Parent application context is responsible for handling those entities
> within a Spring
>
> application context that actually belong to SCA rather than to Spring."
>
>
>
> Clearly there are some issues with the spring implementation that need to
> be resolved.  Unfortunately, right now I don't have the time to continue to
> investigate.
>
>
>
> Phil
>
>
>
> *From:* Simon Laws [mailto:[email protected]]
> *Sent:* Friday, January 23, 2009 8:55 AM
> *To:* [email protected]
> *Subject:* Re: More Tuscany and Spring Questions
>
>
>
>
>
> On Thu, Jan 22, 2009 at 3:33 PM, Sykes, Phil <[email protected]>
> wrote:
>
> Hi,
>
>
>
> Our current application is a Spring/Hibernate app.  I am trying to convert
> it to use Tuscany and SCA.  We currently use Spring for transaction
> management using the aspectj annotations.  After integrating Tuscany I can
> call my components but a transaction is never started.  Each component has
> its own spring context file.  However, all of the transaction configuration,
> aspects, jpa config etc. are in separate context files.  These files are
> loaded via web.xml.  I was wondering, does tuscany create a new spring
> context for each component?  If so, that could explain why transactions (or
> any of the other aop stuff) are not working.  I tried importing the other
> spring files into my component's spring file but then the application would
> not deply.  I'm assuming that either my config is wrong or this kind of
> thing is simply not supported.  Anyone ever try something like this?  Any
> suggestions?
>
>
>
> Thanks,
>
>
>
> Phil
>
>
>
> Philip Sykes * Principal Java Developer, Banner Product Engineering *
> SunGard Higher Education * 3 Country View Road, Malvern PA 19335 * Tel 610
> 578 5185 * [email protected] <[email protected]> *
> www.sungardhe.com
>
>
>
> Hi Phil
>
> Not sure I'm going to be too much use to you here. Ram, who's knows
> implementation.spring is away for a bit I think. Looking at the code, the
> implementation.spring provider creates a couple of application contexts for
> each component that has a spring implementation;
>
> SCAParentApplicationContext - to hold any SCA specific spring artifacts
> defined either explicitly or implicitly in the real application context
>    GenericApplicationContext - the actual application context
>
> If you have multiple contexts which provide additional information I'm not
> sure how that should be specified in the context of a Tuscany component.
> What errors did you see when you imported them into your application
> context?
>
> The best thing for us to do is find or set up a test case that replicates
> what you need to do. If you have one ready made that you could attach to a
> JIRA that would be a good starting point. If not I'm sure we can adapt on of
> the existing tests.
>
> Simon
>
>



-- 
Thanks & Regards,
Ramkumar Ramalingam

Reply via email to