You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Luciano Resende <lu...@gmail.com> on 2013/09/01 14:05:47 UTC

Re: Could you please help me how to consume spring services from tuscany rest services.

On Sat, Aug 31, 2013 at 6:45 AM, Gopi Lokavarapu <go...@gmail.com>wrote:

> Could you please help me to do the following scenario:While using apche
> tuscany with spring implementation
> --------------------------------------------------------------------------
> I have 2 components and spring context file
> I configured as 2 services in spring-context file as spring beans.Now i
> want to access these from tuscany rest binding.
> I attached my spring context file and compoite file
>
>
>
>
> Could you please give me reply please.....
>
>
>
>
>      Thank you
>
>
I have modified the spring sample to expose the helloworld service using
the REST binding, please take a look at

https://svn.apache.org/repos/asf/tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/



-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Fwd: Could you please help me how to consume spring services from tuscany rest services.

Posted by Gopi Lokavarapu <go...@gmail.com>.
Could you please check following attachments.

In this attachments

spring sca services,spring sessionfactory injection,expose those services
to restful
Here two spring based services are there which are exposed as restful .Both
are using same composite file and spring application-context file.Both
service are there in same spring applicationcontext file ,due to this on
the server start up for  each implementaion.spring spring application
conext is loading and creating object for singletons every time .Could
please send me the correct way to do the this.



Thank you

Fwd: Could you please help me how to consume spring services from tuscany rest services.

Posted by Gopi Lokavarapu <go...@gmail.com>.
Could you please check following attachments.

In this attachments

spring sca services,spring sessionfactory injection,expose those services
to restful
Here two spring based services are there which are exposed as restful .Both
are using same composite file and spring application-context file.Both
service are there in same spring applicationcontext file ,due to this on
the server start up for  each implementaion.spring spring application
conext is loading and creating object for singletons every time .Could
please send me the correct way to do the this.



Thank you

Re: Could you please help me how to consume spring services from tuscany rest services.

Posted by Luciano Resende <lu...@gmail.com>.
Could you provide a sample app or a test case to reproduce the problem ? It
would make it much easier to investigate the issue.

Thanks


On Fri, Sep 13, 2013 at 11:16 PM, Gopi Lokavarapu
<go...@gmail.com>wrote:

> could you please help how can I resolve the following issue
>
>  one component in composite file then <implementation.spring
> location="/someLocation"> is declared one time,like that
> <composite>
>  <component name="component1">
>    <implementation.spring="/somLocation/spring-conentx.xml" />
>     <service name="component1Service">
>       <tuscany:binding.rest uri="http://localhost:8085/hell0"/> //here
> can i give like this uri="/hello' (if it is tomcat server)
>    </service>
> </component>
> <component name="component2">
> <implementation.spring="/somLocation/spring-conentx.xml" />
>     <service name="component2Service">
>       <tuscany:binding.rest uri="http://localhost:8085/hell01"/> //here
> can i give like this uri="/hello1' (if it is tomcat server)
>    </service>
> </component>
>
> .................
> .................
> .................
> <component name="componentN'>
> <implementation.spring="/somLocation/spring-conentx.xml" />
>     <service name="componentNService">
>       <tuscany:binding.rest uri="http://localhost:8085/hell0N"/>
>    </service>
> </component>
>
> </composite>
>
> Problem:From the above scenario spring-context.xml contains all services
> as beans,sessionFactory obj bean also there in spring-context.xml.Now
> whenever I start the server,every time all service beans instatntiation
> takesplace.
> i.e
> <beans>
> <bean id="mySessionFactroy" class="LocalSessionFactoryBean"/>
>   <sca:service name="Component1Service" target="bean1"/>
>   <sca:service name="Component2Service" target="bean2"/>
> ..................................................
> ..................................................
>   <sca:service name="ComponentNService" target="beanN"/>
> <bean id="bean1" class="class1"/>
> <bean id="bean2" class="class2"/>
> ....................
> ................
> <bean id="bean3" class="classN"/>
> </beans>.
> i.e
> whenever loading composite file
> for every implementaion.spring all beans instantiation is takesplace
> component1---->implementation.spring------>bean id="bean1"
> component2----->implementaion.spring------->bean id="bean1' bean id="bean2'
> ---------------------------------------
> ---------------------------------------
> componentN------->implementaion.spring------>bean id="bean1" bean
> id="bean2"...........bean id="beanN"
>
>
>
>
>
> Thank you
>
> T
>
>


-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Fwd: Could you please help me how to consume spring services from tuscany rest services.

Posted by Gopi Lokavarapu <go...@gmail.com>.
could you please help how can I resolve the following issue

 one component in composite file then <implementation.spring
location="/someLocation"> is declared one time,like that
<composite>
 <component name="component1">
   <implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="component1Service">
      <tuscany:binding.rest uri="http://localhost:8085/hell0"/> //here can
i give like this uri="/hello' (if it is tomcat server)
   </service>
</component>
<component name="component2">
<implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="component2Service">
      <tuscany:binding.rest uri="http://localhost:8085/hell01"/> //here can
i give like this uri="/hello1' (if it is tomcat server)
   </service>
</component>

.................
.................
.................
<component name="componentN'>
<implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="componentNService">
      <tuscany:binding.rest uri="http://localhost:8085/hell0N"/>
   </service>
</component>

</composite>

Problem:From the above scenario spring-context.xml contains all services as
beans,sessionFactory obj bean also there in spring-context.xml.Now whenever
I start the server,every time all service beans instatntiation takesplace.
i.e
<beans>
<bean id="mySessionFactroy" class="LocalSessionFactoryBean"/>
  <sca:service name="Component1Service" target="bean1"/>
  <sca:service name="Component2Service" target="bean2"/>
..................................................
..................................................
  <sca:service name="ComponentNService" target="beanN"/>
<bean id="bean1" class="class1"/>
<bean id="bean2" class="class2"/>
....................
................
<bean id="bean3" class="classN"/>
</beans>.
i.e
whenever loading composite file
for every implementaion.spring all beans instantiation is takesplace
component1---->implementation.spring------>bean id="bean1"
component2----->implementaion.spring------->bean id="bean1' bean id="bean2'
---------------------------------------
---------------------------------------
componentN------->implementaion.spring------>bean id="bean1" bean
id="bean2"...........bean id="beanN"





Thank you

T

Re: Could you please help me how to consume spring services from tuscany rest services.

Posted by Gopi Lokavarapu <go...@gmail.com>.
Thank you so much for the response given to me.But I have another
problem.That is, if it is one component in composite file then
<implementation.spring location="/someLocation"> is declared one time,like
that
<composite>
 <component name="component1">
   <implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="component1Service">
      <tuscany:binding.rest uri="http://localhost:8085/hell0"/> //here can
i give like this uri="/hello' (if it is tomcat server)
   </service>
</component>
<component name="component2">
<implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="component2Service">
      <tuscany:binding.rest uri="http://localhost:8085/hell01"/> //here can
i give like this uri="/hello1' (if it is tomcat server)
   </service>
</component>

.................
.................
.................
<component name="componentN'>
<implementation.spring="/somLocation/spring-conentx.xml" />
    <service name="componentNService">
      <tuscany:binding.rest uri="http://localhost:8085/hell0N"/>
   </service>
</component>

</composite>

Problem:From the above scenario spring-context.xml contains all services as
beans,sessionFactory obj bean also there in spring-context.xml.Now whenever
i given a call to service ,every time all service beans instatntiation
takesplace.
i.e
<beans>
<bean id="mySessionFactroy" class="LocalSessionFactoryBean"/>
  <sca:service name="Component1Service" target="bean1"/>
  <sca:service name="Component2Service" target="bean2"/>
..................................................
..................................................
  <sca:service name="ComponentNService" target="beanN"/>
<bean id="bean1" class="class1"/>
<bean id="bean2" class="class2"/>
....................
................
<bean id="bean3" class="classN"/>
</beans>

In the above scenario whenever i run the application with tomcat7 with
apache-wink runtime ,how many components are there in composite file
corresponding times spring-context file is loading,at that time it is
creating objects for everty eventhoug objects are laready intantiated.
i.e
whenever loading composite file
for every implementaion.spring all beans instantiation is takesplace
component1---->implementation.spring------>bean id="bean1"
component2----->implementaion.spring------->bean id="bean1' bean id="bean2'
---------------------------------------
---------------------------------------
componentN------->implementaion.spring------>bean id="bean1" bean
id="bean2"...........bean id="beanN"

first implementation.spring bean1 is instantiatied,
second  implementation.spring again bean1 is instantiatied along with bean2
---------------------------
------------------
N th time  implementation.spring again bean1 is instantiatied along with
bean2,bean2.........beanN


Could please help me how to resolve this problem.


Thank you

T


On Sun, Sep 1, 2013 at 5:35 PM, Luciano Resende <lu...@gmail.com>wrote:

>
>
> On Sat, Aug 31, 2013 at 6:45 AM, Gopi Lokavarapu <go...@gmail.com>wrote:
>
>> Could you please help me to do the following scenario:While using apche
>> tuscany with spring implementation
>> --------------------------------------------------------------------------
>> I have 2 components and spring context file
>> I configured as 2 services in spring-context file as spring beans.Now i
>> want to access these from tuscany rest binding.
>> I attached my spring context file and compoite file
>>
>>
>>
>>
>> Could you please give me reply please.....
>>
>>
>>
>>
>>      Thank you
>>
>>
> I have modified the spring sample to expose the helloworld service using
> the REST binding, please take a look at
>
>
> https://svn.apache.org/repos/asf/tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>