You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Sykes, Phil" <Ph...@sungardhe.com> on 2009/01/22 16:33:46 UTC

More Tuscany and Spring Questions

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 * Phil.Sykes@sungardhe.com<ma...@sungardhe.com> * www.sungardhe.com<http://www.sungardhe.com/>


Re: More Tuscany and Spring Questions

Posted by Ramkumar R <ra...@gmail.com>.
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 <Ph...@sungardhe.com>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:simonslaws@googlemail.com]
> *Sent:* Friday, January 23, 2009 8:55 AM
> *To:* user@tuscany.apache.org
> *Subject:* Re: More Tuscany and Spring Questions
>
>
>
>
>
> On Thu, Jan 22, 2009 at 3:33 PM, Sykes, Phil <Ph...@sungardhe.com>
> 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 * Phil.Sykes@sungardhe.com <Ka...@sungardhe.com> *
> 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

RE: More Tuscany and Spring Questions

Posted by "Sykes, Phil" <Ph...@sungardhe.com>.
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:simonslaws@googlemail.com]
Sent: Friday, January 23, 2009 8:55 AM
To: user@tuscany.apache.org
Subject: Re: More Tuscany and Spring Questions


On Thu, Jan 22, 2009 at 3:33 PM, Sykes, Phil <Ph...@sungardhe.com>> 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 * Phil.Sykes@sungardhe.com<ma...@sungardhe.com> * www.sungardhe.com<http://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


RE: More Tuscany and Spring Questions

Posted by "Sykes, Phil" <Ph...@sungardhe.com>.
Simon,

Below is the stack trace for the error that occurs at deployment when I attempt to import my other spring config files. It looks like Tuscany fails attempting to call the constructor for some class defined in my configuration.   I've also included my spring config files so you can see what I am doing.  If what you said below is true I would think that I don't even need to do the import.  However, when I don't, none of the aspects fire.  I will attempt to create a test case but it will take some time to develop with out giving you my entire environment.  Thanks for any help you can provide.

09/01/23 10:11:08 oracle.oc4j.admin.internal.DeployerException: java.lang.reflec
t.InvocationTargetException
09/01/23 10:11:08       at org.apache.tuscany.sca.host.embedded.SCADomain.create
NewInstance(SCADomain.java:220)
09/01/23 10:11:08       at org.apache.tuscany.sca.host.embedded.SCADomain.newIns
tance(SCADomain.java:76)
09/01/23 10:11:08       at org.apache.tuscany.sca.host.webapp.WebAppServletHost.
init(WebAppServletHost.java:220)
09/01/23 10:11:08       at org.apache.tuscany.sca.host.webapp.TuscanyContextList
ener.contextInitialized(TuscanyContextListener.java:43)
09/01/23 10:11:08       at com.evermind.server.http.HttpApplication.initDynamic(
HttpApplication.java:1140)
09/01/23 10:11:08       at com.evermind.server.http.HttpApplication.<init>(HttpA
pplication.java:741)
09/01/23 10:11:08       at com.evermind.server.ApplicationStateRunning.getHttpAp
plication(ApplicationStateRunning.java:431)
09/01/23 10:11:08       at com.evermind.server.Application.getHttpApplication(Ap
plication.java:586)
09/01/23 10:11:08       at com.evermind.server.http.HttpSite$HttpApplicationRunT
imeReference.createHttpApplicationFromReference(HttpSite.java:1987)
09/01/23 10:11:08       at com.evermind.server.http.HttpSite$HttpApplicationRunT
imeReference.<init>(HttpSite.java:1906)
09/01/23 10:11:08       at com.evermind.server.http.HttpSite.addHttpApplication(
HttpSite.java:1603)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.WebApplicationBinder.bindW
ebApp(WebApplicationBinder.java:302)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.WebApplicationBinder.bindW
ebApp(WebApplicationBinder.java:121)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.WebApplicationBinder.bindW
ebApp(WebApplicationBinder.java:99)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.ApplicationDeployer.bindWe
bApp(ApplicationDeployer.java:550)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.ApplicationDeployer.doDepl
oy(ApplicationDeployer.java:205)
09/01/23 10:11:08       at oracle.oc4j.admin.internal.DeployerBase.execute(Deplo
yerBase.java:93)
09/01/23 10:11:08       at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeploy
erRunnable.doRun(OC4JDeployerRunnable.java:52)
09/01/23 10:11:08       at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRu
nnable.run(DeployerRunnable.java:81)
09/01/23 10:11:08       at com.evermind.util.ReleasableResourcePooledExecutor$My
Worker.run(ReleasableResourcePooledExecutor.java:303)
09/01/23 10:11:08       at java.lang.Thread.run(Thread.java:619)



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:sca="http://www.springframework.org/schema/sca"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                    http://www.springframework.org/schema/aop
                    http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
                    http://www.springframework.org/schema/tx
                    http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
                    http://www.springframework.org/schema/sca
                    http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">

<import location="applicationContext-common.xml" />
<import location="applicationContext.xml" />

   <sca:service name="FacultyGrading" type="com.sungardhe.banner.student.component.grading.GradingService" target="gradingComponentImpl"/>

   <sca:service name="FacultyGradingSoap" type="com.sungardhe.banner.student.component.grading.GradingSoapService" target="gradingComponentImpl"/>

    <bean id="gradingComponentImpl" class="com.sungardhe.banner.student.component.grading.impl.GradingImpl">
         <property name="localizationService" ref="localizationService"/>
         <property name="electronicCommunicationService" ref="electronicCommunicationService"/>
         <property name="validGradeCalculatorService" ref="validGradeCalculatorService"/>
         <property name="ruleEngine" ref="ruleEngine"/>
    </bean>

    <sca:reference name="localizationService" type="com.sungardhe.banner.common.component.i18n.LocalizationService"/>
    <sca:reference name="validGradeCalculatorService" type="com.sungardhe.banner.student.component.grading.ValidGradeCalculatorService"/>
    <sca:reference name="electronicCommunicationService" type="com.sungardhe.banner.common.component.communication.ElectronicCommunicationService"/>
    <sca:reference name="ruleEngine" type="com.sungardhe.banner.common.component.rules.RuleEngine"/>

</beans>


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">



  <!--=========== JPA Configuration ===========-->

  <!-- This is the entity manager factory required by jpa. -->

  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
   <property name="persistenceUnitName" value="student"/>
    <property name="jpaProperties">
      <props>
        <prop key="hibernate.ejb.naming_strategy">
          org.hibernate.cfg.ImprovedNamingStrategy
        </prop>
      </props>
    </property>

    <property name="jpaVendorAdapter">

    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="database" value="ORACLE"/>
        <property name="showSql" value="true"/>
     </bean>

    </property>
  </bean>

  <!-- This is the JPA persistence system.  Note that it requires you to
         set the entity manager factory.  Comment this out if not using JPA. -->
  <bean id="jpaPersistenceSystem" class="com.sungardhe.banner.common.persistence.jpa.JpaPersistenceSystem">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>


  <!-- This tells Spring to use the @Tranactional annotation to configure transactions.   -->

  <tx:annotation-driven />

  <!-- This is the dialect used to the JPA entity manager.  You can comment this bean if not using JPA.  -->

  <bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" autowire="no" />

  <!-- This is the transaction manager for JPA.  You can comment this line if not using JPA -->

  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>

  <bean id="persistenceSystemFactory"
          class="com.sungardhe.banner.common.persistence.PersistenceSystemFactory">

    <property name="persistenceSystemMap">
      <ref bean="persistenceSystemMap"/>
    </property>

  </bean>

  <!--=========== JDBC Configuration ===========-->

  <!-- This is the JDBC persistence system. DAO map should be configured in individual projects. -->

    <bean id="jdbcPersistenceSystem"
        class="com.sungardhe.banner.common.persistence.jdbc.JdbcPersistenceSystem" depends-on="persistenceSystemMap">

      <property name="daoMap" ref="daoMap"/>

    </bean>

  <!--=========== Localization Configuration ===========-->

  <!-- Configure a strategy for resolving the locale.-->

  <bean id="localeResolver" class="org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver"/>


  <!-- Configure a message source that will load the resource bundles based upon the identified basenames.-->
  <bean id="localeMessageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
      <list>
        <value>resources/locale/commonexceptions</value>
      </list>
    </property>
  </bean>

  <!-- Abstract Service -->
  <bean id="abstractComponent" class="com.sungardhe.banner.common.component.AbstractComponent" abstract="true">

  </bean>


  <!--=========== DAOs ===========-->
  <bean id="personDao" class="com.sungardhe.banner.common.component.person.dao.PersonDAO" depends-on="dataSource" >
    <property name="dataSource">
      <ref bean="dataSource" />
    </property>
  </bean>

  <bean id="biographicalInformationDao" class="com.sungardhe.banner.common.component.person.dao.BiographicalInformationDAO" depends-on="dataSource" >
    <property name="dataSource">
      <ref bean="dataSource" />
    </property>
  </bean>

  <bean id="emailAddressDao" class="com.sungardhe.banner.common.component.person.dao.EmailAddressDAO" depends-on="dataSource" >
    <property name="dataSource">
      <ref bean="dataSource" />
    </property>
  </bean>

  <bean id="telephoneNumberDao" class="com.sungardhe.banner.common.component.person.dao.TelephoneNumberDAO" depends-on="dataSource" >
    <property name="dataSource">
      <ref bean="dataSource" />
    </property>
  </bean>

  <bean id="addressDao" class="com.sungardhe.banner.common.component.person.dao.AddressDAO" depends-on="dataSource" >
    <property name="dataSource">
      <ref bean="dataSource" />
    </property>
  </bean>


  <!--=========== Aspects ===========-->

  <!-- Enables aspectj annotation support -->
  <aop:aspectj-autoproxy/>

  <!-- automatically inserts the current user in to the lastModifiedBy field prior to persistence -->

  <bean id="lastModifiedByAspect" class="com.sungardhe.banner.common.advisor.LastModifiedByAdvisor" />

  <!-- automatically inserts the current date and time in to the lastModified field prior to persistence -->

  <bean id="lastModifiedAspect" class="com.sungardhe.banner.common.advisor.LastModifiedAdvisor" />

  <bean id="transxCommitExcAdvisor" class="com.sungardhe.banner.common.advisor.TransactionCommitExceptionAdvisor" >
    <property name="exceptionMapper" ref="exceptionMapper"/>
    <property name="localizationService" ref="localizationService"/>
  </bean>

  <bean id="debugLoggingAdvisor" class="com.sungardhe.banner.common.advisor.DebugAdvisor" />


  <!--=========== Exception Mapper ===========-->
  <bean id="exceptionMapper" class="com.sungardhe.banner.common.exception.constraint.ExceptionMapper">
    <property name="exceptionMappings" value="classpath:resources/config/transaction_commit_exception_mappings.xml"/>
    <property name="dataSource" ref="dataSource"/>
  </bean>
  <!--=========== Post Processors ===========-->
  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
  <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

</beans>

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                    http://www.springframework.org/schema/aop
                    http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
                    http://www.springframework.org/schema/tx
                    http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">


    <!--=========== Datasources =========== -->

    <!-- Note: JDBC substitution parameters are loaded via a jdbc.properties file. -->
    <bean id="chdbPoolAdapter" class="org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS">
        <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:optimus1"/>
        <property name="user" value=""/>
        <property name="password" value="" />
    </bean>

    <bean id="wrappedDataSource" class="org.apache.commons.dbcp.datasources.SharedPoolDataSource">
        <property name="connectionPoolDataSource" ref="chdbPoolAdapter"/>
        <property name="maxActive" value="-1"/>
        <property name="maxIdle" value="8"/>
        <property name="maxWait" value="-1"/>
        <property name="defaultAutoCommit" value="false"/>
    </bean>

    <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"/>

    <bean id="dataSource" class="com.sungardhe.banner.common.persistence.ProxyDataSource" >
        <property name="dataSource" ref="wrappedDataSource"/>
        <property name="nativeJdbcExtractor" ref="nativeJdbcExtractor"/>
        <property name="proxy" value="false"/>
    </bean>

    <!-- Persistence System Map -->

    <!-- This is the map of persistent class to persistence system used by persistence system factory. -->

    <bean id="persistenceSystemMap" class="org.springframework.beans.factory.config.MapFactoryBean">
        <property name="sourceMap">
            <map>
                <entry>
                    <key>
                        <value>default</value>
                    </key>
                    <ref bean="jpaPersistenceSystem"/>
                </entry>
                <entry>
                    <key>
                        <value>jpa</value>
                    </key>
                    <ref bean="jpaPersistenceSystem" />
                </entry>
                <entry>
                    <key>
                        <value>jdbc</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem" />
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.Person</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem"/>
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.BiographicalInformation</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem"/>
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.EmailAddress</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem"/>
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.TelephoneNumber</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem"/>
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.Address</value>
                    </key>
                    <ref bean="jdbcPersistenceSystem"/>
                </entry>
            </map>
        </property>
    </bean>

    <!-- JDBC Persistence System DAO Map -->

    <bean id="daoMap" class="org.springframework.beans.factory.config.MapFactoryBean">
        <property name="sourceMap">
            <map>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.Person</value>
                    </key>
                    <ref bean="personDao" />
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.BiographicalInformation</value>
                    </key>
                    <ref bean="biographicalInformationDao" />
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.EmailAddress</value>
                    </key>
                    <ref bean="emailAddressDao" />
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.TelephoneNumber</value>
                    </key>
                    <ref bean="telephoneNumberDao" />
                </entry>
                <entry>
                    <key>
                        <value>com.sungardhe.banner.common.business.person.Address</value>
                    </key>
                    <ref bean="addressDao" />
                </entry>
            </map>
        </property>
    </bean>

</beans>

From: Simon Laws [mailto:simonslaws@googlemail.com]
Sent: Friday, January 23, 2009 8:55 AM
To: user@tuscany.apache.org
Subject: Re: More Tuscany and Spring Questions


On Thu, Jan 22, 2009 at 3:33 PM, Sykes, Phil <Ph...@sungardhe.com>> 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 * Phil.Sykes@sungardhe.com<ma...@sungardhe.com> * www.sungardhe.com<http://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


Re: More Tuscany and Spring Questions

Posted by Simon Laws <si...@googlemail.com>.
On Thu, Jan 22, 2009 at 3:33 PM, Sykes, Phil <Ph...@sungardhe.com>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 * Phil.Sykes@sungardhe.com <Ka...@sungardhe.com> *
> 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