You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Kunle Gbadamosi <kg...@gmail.com> on 2009/10/22 05:11:41 UTC

Tuscany + Spring

Hi All,
We have a Spring Composite that we would like to expose as Web Service using
Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA and
the application-context resides in the JAR. Here is what the structure of of
the MyApp.jar looks like -

> com.mycompany.account.das...
> META-INF
> application-context.xml
> config.properties
> spring-dao.xml

The application-context imports other dependent Spring config already, so if
I include this MyApp.jar in my classpath in a new eclipse project, I can do
a quick Java Test in 3 lines as follows -

ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {
"application-context.xml"});

BusinessService service = (BusinessService) ctx.getBean("accountService");

service.sayHello("Kunle");



Moving to Tuscany, I have a simple composite as follows -


<component name="AccountManagementServiceComponent">

    <implementation.spring location="./application-context.xml"/>

    <service name="AccountManagementService">

        <interface.java interface="com.mycompany.BusinessService"/>

    </service>

</component>


For some reason, Tuscany cannot resolve the Location of the
application-context (in a JAR file in the classpath). We keep getting the
following error -


Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
org.apache.tuscany.sca.contribution.service.ContributionResolveException:
org.apache.tuscany.sca.contribution.service.ContributionReadException:
Location cannot be resloved: /application-context.xml

at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)

at
org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(
NodeFactoryImpl.java:37)



We would appreciate any help we can get. This is really holding us back.



Thanks,

Kunle.

Re: Tuscany + Spring

Posted by Ramkumar R <ra...@gmail.com>.
Hi Kunle,

That gives a clear picture, and the issue here is about accessing the
application-context.xml file within the MyApp.jar. The Spring implmentation
(@location) requires the path to the application-context.xml file to be
relative to the current contribution (in your case MySCAApp.war). I believe
the situation here is to read a file which is within a jar, which inturn is
within a war file. Tuscany runtime currently does not support jar within jar
scenarios.

May be you need to consider using folder contribution either for MySCAApp or
for MyApp instead of using war and jar.

On Thu, Oct 22, 2009 at 4:17 PM, Kunle Gbadamosi <kg...@gmail.com>wrote:

> Hi Ramkumar,
>
> It resides outside the jar. MyApp.jar is a complete Spring+Hibernate
> application, unaware of SCA. The idea is to SCA-enable it by creating
> another webapp called MySCAApp.war that includes -
> resources/
>    AccountMgt.composite (src)
> webapp/
>    META-INF/
>       sca-contribution.xml
>    WEB-INF/
>       classes/
>          AccountMgt.composite
>       lib/
>          MyApp.jar
>          .... (other jars)
>       web.xml
>
>
> And then have AccountMgt.composite load the application-context -
>
> <component name="AccountManagementServiceComponent">
>      <implementation.spring location="./application-context.xml"/>
>      <service name="AccountManagementService">
>          <interface.java interface="com.mycompany.BusinessService"/>
>      </service>
> </component>
>
> Locating the application-context (in the classpath) this way is what is
> difficult. Meanwhile I can do the same in a test class simply by doing -
> new ClassPathXmlApplicationContext(new
> String[]{"application-context.xml"});
>
>
> Thanks,
> Kunle
>
>
>
> On Thu, Oct 22, 2009 at 1:48 AM, Ramkumar R <ra...@gmail.com> wrote:
>
>> Hi Kunle,
>>
>> Is your SCA composite residing within the MyApp.jar? OR does it remain
>> outside the MyApp.jar file?
>>
>>
>> On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>>
>>> No, I tried that and it still can't find it.
>>>
>>>
>>>
>>>
>>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <lu...@gmail.com>wrote:
>>>
>>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
>>>> wrote:
>>>> > Hi All,
>>>> > We have a Spring Composite that we would like to expose as Web Service
>>>> using
>>>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA
>>>> and
>>>> > the application-context resides in the JAR. Here is what the structure
>>>> of of
>>>> > the MyApp.jar looks like -
>>>> >> com.mycompany.account.das...
>>>> >> META-INF
>>>> >> application-context.xml
>>>> >> config.properties
>>>> >> spring-dao.xml
>>>> > The application-context imports other dependent Spring config already,
>>>> so if
>>>> > I include this MyApp.jar in my classpath in a new eclipse project, I
>>>> can do
>>>> > a quick Java Test in 3 lines as follows -
>>>> >
>>>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new
>>>> String[]
>>>> > {"application-context.xml"});
>>>> >
>>>> > BusinessService service = (BusinessService)
>>>> ctx.getBean("accountService");
>>>> >
>>>> > service.sayHello("Kunle");
>>>> >
>>>> > Moving to Tuscany, I have a simple composite as follows -
>>>> >
>>>> > <component name="AccountManagementServiceComponent">
>>>> >
>>>> >     <implementation.spring location="./application-context.xml"/>
>>>> >
>>>> >     <service name="AccountManagementService">
>>>> >
>>>> >         <interface.java interface="com.mycompany.BusinessService"/>
>>>> >
>>>> >     </service>
>>>> >
>>>> > </component>
>>>> >
>>>> > For some reason, Tuscany cannot resolve the Location of the
>>>> > application-context (in a JAR file in the classpath). We keep getting
>>>> the
>>>> > following error -
>>>> >
>>>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>>>> >
>>>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>>>> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
>>>> > Location cannot be resloved: /application-context.xml
>>>> >
>>>> > at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>>>> >
>>>> > at
>>>> >
>>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>>>> >
>>>> > We would appreciate any help we can get. This is really holding us
>>>> back.
>>>> >
>>>> > Thanks,
>>>> >
>>>> > Kunle.
>>>> >
>>>>
>>>> Does it make any difference if you remove the "./"  from the
>>>> implementation.spring in the composite
>>>>
>>>> <implementation.spring location="application-context.xml"/>
>>>>
>>>>
>>>> --
>>>> Luciano Resende
>>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>>> http://lresende.blogspot.com/
>>>>
>>>
>>>
>>
>>
>> --
>> Thanks & Regards,
>> Ramkumar Ramalingam
>>
>
>


-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: Tuscany + Spring

Posted by Kunle Gbadamosi <kg...@gmail.com>.
Ramkumar,
Thanks for the explanation. We're are wondering if there's a work-around.

Here's our scenario - Our current approach is modularized, so there are some
other Spring-related config files that are in other jar files in the
classpath as well, which are then imported into the main application-context
using Spring <Import>.


So even when application-context and the sca contribution are relative,
tuscany still has problems with the other Spring Config in classpath (JAR).
Which means the Classpath limitation will limit us on this.

The next question I have is -

Is there a work around to using Tuscany's implementation.spring ?

Thanks,
Kunle.



On Fri, Oct 23, 2009 at 3:07 AM, Ramkumar R <ra...@gmail.com> wrote:

> Hi Kunle,
>
> The ClassLoader issue that Raymond pointed out is about supporting only
> relative contribution paths for the @location attribute. As the earlier code
> was supporting paths outside of contributions for the @location attribute.
>
> And this issue is being addressed in version 1.5.1 of Tuscany.
>
>
> On Fri, Oct 23, 2009 at 12:15 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>
>> Ramkumar,
>> While browsing through the mailing list archives, I noticed that Raymond
>> had a similar observation a while back.
>>
>>
>> http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3CACAC0E3516134E2686E8F55185B1E433@rfengt61p%3E
>>
>>
>> So I guess the question is - Does the current Spring Implementation
>> (@location) support loading application-context from Classpath ? Is there a
>> Classloader issue with this approach ?
>>
>>
>>
>> Thanks,
>> Kunle.
>>
>>
>>
>>
>>
>>
>> On Thu, Oct 22, 2009 at 6:47 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>>
>>> Hi Ramkumar,
>>>
>>> It resides outside the jar. MyApp.jar is a complete Spring+Hibernate
>>> application, unaware of SCA. The idea is to SCA-enable it by creating
>>> another webapp called MySCAApp.war that includes -
>>> resources/
>>>    AccountMgt.composite (src)
>>> webapp/
>>>    META-INF/
>>>       sca-contribution.xml
>>>    WEB-INF/
>>>       classes/
>>>          AccountMgt.composite
>>>       lib/
>>>          MyApp.jar
>>>          .... (other jars)
>>>       web.xml
>>>
>>>
>>> And then have AccountMgt.composite load the application-context -
>>>
>>> <component name="AccountManagementServiceComponent">
>>>      <implementation.spring location="./application-context.xml"/>
>>>      <service name="AccountManagementService">
>>>          <interface.java interface="com.mycompany.BusinessService"/>
>>>      </service>
>>> </component>
>>>
>>> Locating the application-context (in the classpath) this way is what is
>>> difficult. Meanwhile I can do the same in a test class simply by doing -
>>>  new ClassPathXmlApplicationContext(new
>>> String[]{"application-context.xml"});
>>>
>>>
>>> Thanks,
>>> Kunle
>>>
>>>
>>>
>>> On Thu, Oct 22, 2009 at 1:48 AM, Ramkumar R <ra...@gmail.com>wrote:
>>>
>>>> Hi Kunle,
>>>>
>>>> Is your SCA composite residing within the MyApp.jar? OR does it remain
>>>> outside the MyApp.jar file?
>>>>
>>>>
>>>> On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>>>>
>>>>> No, I tried that and it still can't find it.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <
>>>>> luckbr1975@gmail.com> wrote:
>>>>>
>>>>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <
>>>>>> kgbadamosi@gmail.com> wrote:
>>>>>> > Hi All,
>>>>>> > We have a Spring Composite that we would like to expose as Web
>>>>>> Service using
>>>>>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of
>>>>>> SCA and
>>>>>> > the application-context resides in the JAR. Here is what the
>>>>>> structure of of
>>>>>> > the MyApp.jar looks like -
>>>>>> >> com.mycompany.account.das...
>>>>>> >> META-INF
>>>>>> >> application-context.xml
>>>>>> >> config.properties
>>>>>> >> spring-dao.xml
>>>>>> > The application-context imports other dependent Spring config
>>>>>> already, so if
>>>>>> > I include this MyApp.jar in my classpath in a new eclipse project, I
>>>>>> can do
>>>>>> > a quick Java Test in 3 lines as follows -
>>>>>> >
>>>>>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new
>>>>>> String[]
>>>>>> > {"application-context.xml"});
>>>>>> >
>>>>>> > BusinessService service = (BusinessService)
>>>>>> ctx.getBean("accountService");
>>>>>> >
>>>>>> > service.sayHello("Kunle");
>>>>>> >
>>>>>> > Moving to Tuscany, I have a simple composite as follows -
>>>>>> >
>>>>>> > <component name="AccountManagementServiceComponent">
>>>>>> >
>>>>>> >     <implementation.spring location="./application-context.xml"/>
>>>>>> >
>>>>>> >     <service name="AccountManagementService">
>>>>>> >
>>>>>> >         <interface.java interface="com.mycompany.BusinessService"/>
>>>>>> >
>>>>>> >     </service>
>>>>>> >
>>>>>> > </component>
>>>>>> >
>>>>>> > For some reason, Tuscany cannot resolve the Location of the
>>>>>> > application-context (in a JAR file in the classpath). We keep
>>>>>> getting the
>>>>>> > following error -
>>>>>> >
>>>>>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>>>>>> >
>>>>>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>>>>>> >
>>>>>> org.apache.tuscany.sca.contribution.service.ContributionReadException:
>>>>>> > Location cannot be resloved: /application-context.xml
>>>>>> >
>>>>>> > at
>>>>>> org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>>>>>> >
>>>>>> > at
>>>>>> >
>>>>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>>>>>> >
>>>>>> > We would appreciate any help we can get. This is really holding us
>>>>>> back.
>>>>>> >
>>>>>> > Thanks,
>>>>>> >
>>>>>> > Kunle.
>>>>>> >
>>>>>>
>>>>>> Does it make any difference if you remove the "./"  from the
>>>>>> implementation.spring in the composite
>>>>>>
>>>>>> <implementation.spring location="application-context.xml"/>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Luciano Resende
>>>>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>>>>> http://lresende.blogspot.com/
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks & Regards,
>>>> Ramkumar Ramalingam
>>>>
>>>
>>>
>>
>
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Re: Tuscany + Spring

Posted by Ramkumar R <ra...@gmail.com>.
Hi Kunle,

The ClassLoader issue that Raymond pointed out is about supporting only
relative contribution paths for the @location attribute. As the earlier code
was supporting paths outside of contributions for the @location attribute.

And this issue is being addressed in version 1.5.1 of Tuscany.

On Fri, Oct 23, 2009 at 12:15 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:

> Ramkumar,
> While browsing through the mailing list archives, I noticed that Raymond
> had a similar observation a while back.
>
>
> http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3CACAC0E3516134E2686E8F55185B1E433@rfengt61p%3E
>
>
> So I guess the question is - Does the current Spring Implementation
> (@location) support loading application-context from Classpath ? Is there a
> Classloader issue with this approach ?
>
>
>
> Thanks,
> Kunle.
>
>
>
>
>
>
> On Thu, Oct 22, 2009 at 6:47 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>
>> Hi Ramkumar,
>>
>> It resides outside the jar. MyApp.jar is a complete Spring+Hibernate
>> application, unaware of SCA. The idea is to SCA-enable it by creating
>> another webapp called MySCAApp.war that includes -
>> resources/
>>    AccountMgt.composite (src)
>> webapp/
>>    META-INF/
>>       sca-contribution.xml
>>    WEB-INF/
>>       classes/
>>          AccountMgt.composite
>>       lib/
>>          MyApp.jar
>>          .... (other jars)
>>       web.xml
>>
>>
>> And then have AccountMgt.composite load the application-context -
>>
>> <component name="AccountManagementServiceComponent">
>>      <implementation.spring location="./application-context.xml"/>
>>      <service name="AccountManagementService">
>>          <interface.java interface="com.mycompany.BusinessService"/>
>>      </service>
>> </component>
>>
>> Locating the application-context (in the classpath) this way is what is
>> difficult. Meanwhile I can do the same in a test class simply by doing -
>>  new ClassPathXmlApplicationContext(new
>> String[]{"application-context.xml"});
>>
>>
>> Thanks,
>> Kunle
>>
>>
>>
>> On Thu, Oct 22, 2009 at 1:48 AM, Ramkumar R <ra...@gmail.com>wrote:
>>
>>> Hi Kunle,
>>>
>>> Is your SCA composite residing within the MyApp.jar? OR does it remain
>>> outside the MyApp.jar file?
>>>
>>>
>>> On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>>>
>>>> No, I tried that and it still can't find it.
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <luckbr1975@gmail.com
>>>> > wrote:
>>>>
>>>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
>>>>> wrote:
>>>>> > Hi All,
>>>>> > We have a Spring Composite that we would like to expose as Web
>>>>> Service using
>>>>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of
>>>>> SCA and
>>>>> > the application-context resides in the JAR. Here is what the
>>>>> structure of of
>>>>> > the MyApp.jar looks like -
>>>>> >> com.mycompany.account.das...
>>>>> >> META-INF
>>>>> >> application-context.xml
>>>>> >> config.properties
>>>>> >> spring-dao.xml
>>>>> > The application-context imports other dependent Spring config
>>>>> already, so if
>>>>> > I include this MyApp.jar in my classpath in a new eclipse project, I
>>>>> can do
>>>>> > a quick Java Test in 3 lines as follows -
>>>>> >
>>>>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new
>>>>> String[]
>>>>> > {"application-context.xml"});
>>>>> >
>>>>> > BusinessService service = (BusinessService)
>>>>> ctx.getBean("accountService");
>>>>> >
>>>>> > service.sayHello("Kunle");
>>>>> >
>>>>> > Moving to Tuscany, I have a simple composite as follows -
>>>>> >
>>>>> > <component name="AccountManagementServiceComponent">
>>>>> >
>>>>> >     <implementation.spring location="./application-context.xml"/>
>>>>> >
>>>>> >     <service name="AccountManagementService">
>>>>> >
>>>>> >         <interface.java interface="com.mycompany.BusinessService"/>
>>>>> >
>>>>> >     </service>
>>>>> >
>>>>> > </component>
>>>>> >
>>>>> > For some reason, Tuscany cannot resolve the Location of the
>>>>> > application-context (in a JAR file in the classpath). We keep getting
>>>>> the
>>>>> > following error -
>>>>> >
>>>>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>>>>> >
>>>>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>>>>> >
>>>>> org.apache.tuscany.sca.contribution.service.ContributionReadException:
>>>>> > Location cannot be resloved: /application-context.xml
>>>>> >
>>>>> > at
>>>>> org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>>>>> >
>>>>> > at
>>>>> >
>>>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>>>>> >
>>>>> > We would appreciate any help we can get. This is really holding us
>>>>> back.
>>>>> >
>>>>> > Thanks,
>>>>> >
>>>>> > Kunle.
>>>>> >
>>>>>
>>>>> Does it make any difference if you remove the "./"  from the
>>>>> implementation.spring in the composite
>>>>>
>>>>> <implementation.spring location="application-context.xml"/>
>>>>>
>>>>>
>>>>> --
>>>>> Luciano Resende
>>>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>>>> http://lresende.blogspot.com/
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Thanks & Regards,
>>> Ramkumar Ramalingam
>>>
>>
>>
>


-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: Tuscany + Spring

Posted by Kunle Gbadamosi <kg...@gmail.com>.
Ramkumar,
While browsing through the mailing list archives, I noticed that Raymond had
a similar observation a while back.

http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3CACAC0E3516134E2686E8F55185B1E433@rfengt61p%3E


So I guess the question is - Does the current Spring Implementation
(@location) support loading application-context from Classpath ? Is there a
Classloader issue with this approach ?



Thanks,
Kunle.






On Thu, Oct 22, 2009 at 6:47 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:

> Hi Ramkumar,
>
> It resides outside the jar. MyApp.jar is a complete Spring+Hibernate
> application, unaware of SCA. The idea is to SCA-enable it by creating
> another webapp called MySCAApp.war that includes -
> resources/
>    AccountMgt.composite (src)
> webapp/
>    META-INF/
>       sca-contribution.xml
>    WEB-INF/
>       classes/
>          AccountMgt.composite
>       lib/
>          MyApp.jar
>          .... (other jars)
>       web.xml
>
>
> And then have AccountMgt.composite load the application-context -
>
> <component name="AccountManagementServiceComponent">
>      <implementation.spring location="./application-context.xml"/>
>      <service name="AccountManagementService">
>          <interface.java interface="com.mycompany.BusinessService"/>
>      </service>
> </component>
>
> Locating the application-context (in the classpath) this way is what is
> difficult. Meanwhile I can do the same in a test class simply by doing -
> new ClassPathXmlApplicationContext(new
> String[]{"application-context.xml"});
>
>
> Thanks,
> Kunle
>
>
>
> On Thu, Oct 22, 2009 at 1:48 AM, Ramkumar R <ra...@gmail.com> wrote:
>
>> Hi Kunle,
>>
>> Is your SCA composite residing within the MyApp.jar? OR does it remain
>> outside the MyApp.jar file?
>>
>>
>> On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>>
>>> No, I tried that and it still can't find it.
>>>
>>>
>>>
>>>
>>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <lu...@gmail.com>wrote:
>>>
>>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
>>>> wrote:
>>>> > Hi All,
>>>> > We have a Spring Composite that we would like to expose as Web Service
>>>> using
>>>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA
>>>> and
>>>> > the application-context resides in the JAR. Here is what the structure
>>>> of of
>>>> > the MyApp.jar looks like -
>>>> >> com.mycompany.account.das...
>>>> >> META-INF
>>>> >> application-context.xml
>>>> >> config.properties
>>>> >> spring-dao.xml
>>>> > The application-context imports other dependent Spring config already,
>>>> so if
>>>> > I include this MyApp.jar in my classpath in a new eclipse project, I
>>>> can do
>>>> > a quick Java Test in 3 lines as follows -
>>>> >
>>>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new
>>>> String[]
>>>> > {"application-context.xml"});
>>>> >
>>>> > BusinessService service = (BusinessService)
>>>> ctx.getBean("accountService");
>>>> >
>>>> > service.sayHello("Kunle");
>>>> >
>>>> > Moving to Tuscany, I have a simple composite as follows -
>>>> >
>>>> > <component name="AccountManagementServiceComponent">
>>>> >
>>>> >     <implementation.spring location="./application-context.xml"/>
>>>> >
>>>> >     <service name="AccountManagementService">
>>>> >
>>>> >         <interface.java interface="com.mycompany.BusinessService"/>
>>>> >
>>>> >     </service>
>>>> >
>>>> > </component>
>>>> >
>>>> > For some reason, Tuscany cannot resolve the Location of the
>>>> > application-context (in a JAR file in the classpath). We keep getting
>>>> the
>>>> > following error -
>>>> >
>>>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>>>> >
>>>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>>>> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
>>>> > Location cannot be resloved: /application-context.xml
>>>> >
>>>> > at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>>>> >
>>>> > at
>>>> >
>>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>>>> >
>>>> > We would appreciate any help we can get. This is really holding us
>>>> back.
>>>> >
>>>> > Thanks,
>>>> >
>>>> > Kunle.
>>>> >
>>>>
>>>> Does it make any difference if you remove the "./"  from the
>>>> implementation.spring in the composite
>>>>
>>>> <implementation.spring location="application-context.xml"/>
>>>>
>>>>
>>>> --
>>>> Luciano Resende
>>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>>> http://lresende.blogspot.com/
>>>>
>>>
>>>
>>
>>
>> --
>> Thanks & Regards,
>> Ramkumar Ramalingam
>>
>
>

Re: Tuscany + Spring

Posted by Kunle Gbadamosi <kg...@gmail.com>.
Hi Ramkumar,

It resides outside the jar. MyApp.jar is a complete Spring+Hibernate
application, unaware of SCA. The idea is to SCA-enable it by creating
another webapp called MySCAApp.war that includes -
resources/
   AccountMgt.composite (src)
webapp/
   META-INF/
      sca-contribution.xml
   WEB-INF/
      classes/
         AccountMgt.composite
      lib/
         MyApp.jar
         .... (other jars)
      web.xml


And then have AccountMgt.composite load the application-context -

<component name="AccountManagementServiceComponent">
     <implementation.spring location="./application-context.xml"/>
     <service name="AccountManagementService">
         <interface.java interface="com.mycompany.BusinessService"/>
     </service>
</component>

Locating the application-context (in the classpath) this way is what is
difficult. Meanwhile I can do the same in a test class simply by doing -
new ClassPathXmlApplicationContext(new String[]{"application-context.xml"});


Thanks,
Kunle



On Thu, Oct 22, 2009 at 1:48 AM, Ramkumar R <ra...@gmail.com> wrote:

> Hi Kunle,
>
> Is your SCA composite residing within the MyApp.jar? OR does it remain
> outside the MyApp.jar file?
>
>
> On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:
>
>> No, I tried that and it still can't find it.
>>
>>
>>
>>
>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <lu...@gmail.com>wrote:
>>
>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
>>> wrote:
>>> > Hi All,
>>> > We have a Spring Composite that we would like to expose as Web Service
>>> using
>>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA
>>> and
>>> > the application-context resides in the JAR. Here is what the structure
>>> of of
>>> > the MyApp.jar looks like -
>>> >> com.mycompany.account.das...
>>> >> META-INF
>>> >> application-context.xml
>>> >> config.properties
>>> >> spring-dao.xml
>>> > The application-context imports other dependent Spring config already,
>>> so if
>>> > I include this MyApp.jar in my classpath in a new eclipse project, I
>>> can do
>>> > a quick Java Test in 3 lines as follows -
>>> >
>>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new
>>> String[]
>>> > {"application-context.xml"});
>>> >
>>> > BusinessService service = (BusinessService)
>>> ctx.getBean("accountService");
>>> >
>>> > service.sayHello("Kunle");
>>> >
>>> > Moving to Tuscany, I have a simple composite as follows -
>>> >
>>> > <component name="AccountManagementServiceComponent">
>>> >
>>> >     <implementation.spring location="./application-context.xml"/>
>>> >
>>> >     <service name="AccountManagementService">
>>> >
>>> >         <interface.java interface="com.mycompany.BusinessService"/>
>>> >
>>> >     </service>
>>> >
>>> > </component>
>>> >
>>> > For some reason, Tuscany cannot resolve the Location of the
>>> > application-context (in a JAR file in the classpath). We keep getting
>>> the
>>> > following error -
>>> >
>>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>>> >
>>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>>> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
>>> > Location cannot be resloved: /application-context.xml
>>> >
>>> > at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>>> >
>>> > at
>>> >
>>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>>> >
>>> > We would appreciate any help we can get. This is really holding us
>>> back.
>>> >
>>> > Thanks,
>>> >
>>> > Kunle.
>>> >
>>>
>>> Does it make any difference if you remove the "./"  from the
>>> implementation.spring in the composite
>>>
>>> <implementation.spring location="application-context.xml"/>
>>>
>>>
>>> --
>>> Luciano Resende
>>> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende>
>>> http://lresende.blogspot.com/
>>>
>>
>>
>
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>

Re: Tuscany + Spring

Posted by Ramkumar R <ra...@gmail.com>.
Hi Kunle,

Is your SCA composite residing within the MyApp.jar? OR does it remain
outside the MyApp.jar file?

On Thu, Oct 22, 2009 at 9:30 AM, Kunle Gbadamosi <kg...@gmail.com>wrote:

> No, I tried that and it still can't find it.
>
>
>
>
> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <lu...@gmail.com>wrote:
>
>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
>> wrote:
>> > Hi All,
>> > We have a Spring Composite that we would like to expose as Web Service
>> using
>> > Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA
>> and
>> > the application-context resides in the JAR. Here is what the structure
>> of of
>> > the MyApp.jar looks like -
>> >> com.mycompany.account.das...
>> >> META-INF
>> >> application-context.xml
>> >> config.properties
>> >> spring-dao.xml
>> > The application-context imports other dependent Spring config already,
>> so if
>> > I include this MyApp.jar in my classpath in a new eclipse project, I can
>> do
>> > a quick Java Test in 3 lines as follows -
>> >
>> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]
>> > {"application-context.xml"});
>> >
>> > BusinessService service = (BusinessService)
>> ctx.getBean("accountService");
>> >
>> > service.sayHello("Kunle");
>> >
>> > Moving to Tuscany, I have a simple composite as follows -
>> >
>> > <component name="AccountManagementServiceComponent">
>> >
>> >     <implementation.spring location="./application-context.xml"/>
>> >
>> >     <service name="AccountManagementService">
>> >
>> >         <interface.java interface="com.mycompany.BusinessService"/>
>> >
>> >     </service>
>> >
>> > </component>
>> >
>> > For some reason, Tuscany cannot resolve the Location of the
>> > application-context (in a JAR file in the classpath). We keep getting
>> the
>> > following error -
>> >
>> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
>> >
>> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
>> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
>> > Location cannot be resloved: /application-context.xml
>> >
>> > at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>> >
>> > at
>> >
>> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>> >
>> > We would appreciate any help we can get. This is really holding us back.
>> >
>> > Thanks,
>> >
>> > Kunle.
>> >
>>
>> Does it make any difference if you remove the "./"  from the
>> implementation.spring in the composite
>>
>> <implementation.spring location="application-context.xml"/>
>>
>>
>> --
>> Luciano Resende
>> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
>> http://lresende.blogspot.com/
>>
>
>


-- 
Thanks & Regards,
Ramkumar Ramalingam

Re: Tuscany + Spring

Posted by Kunle Gbadamosi <kg...@gmail.com>.
No, I tried that and it still can't find it.



On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com>
> wrote:
> > Hi All,
> > We have a Spring Composite that we would like to expose as Web Service
> using
> > Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA
> and
> > the application-context resides in the JAR. Here is what the structure of
> of
> > the MyApp.jar looks like -
> >> com.mycompany.account.das...
> >> META-INF
> >> application-context.xml
> >> config.properties
> >> spring-dao.xml
> > The application-context imports other dependent Spring config already, so
> if
> > I include this MyApp.jar in my classpath in a new eclipse project, I can
> do
> > a quick Java Test in 3 lines as follows -
> >
> > ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]
> > {"application-context.xml"});
> >
> > BusinessService service = (BusinessService)
> ctx.getBean("accountService");
> >
> > service.sayHello("Kunle");
> >
> > Moving to Tuscany, I have a simple composite as follows -
> >
> > <component name="AccountManagementServiceComponent">
> >
> >     <implementation.spring location="./application-context.xml"/>
> >
> >     <service name="AccountManagementService">
> >
> >         <interface.java interface="com.mycompany.BusinessService"/>
> >
> >     </service>
> >
> > </component>
> >
> > For some reason, Tuscany cannot resolve the Location of the
> > application-context (in a JAR file in the classpath). We keep getting the
> > following error -
> >
> > Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
> > org.apache.tuscany.sca.contribution.service.ContributionResolveException:
> > org.apache.tuscany.sca.contribution.service.ContributionReadException:
> > Location cannot be resloved: /application-context.xml
> >
> > at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
> >
> > at
> >
> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
> >
> > We would appreciate any help we can get. This is really holding us back.
> >
> > Thanks,
> >
> > Kunle.
> >
>
> Does it make any difference if you remove the "./"  from the
> implementation.spring in the composite
>
> <implementation.spring location="application-context.xml"/>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>

Re: Tuscany + Spring

Posted by Luciano Resende <lu...@gmail.com>.
On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kg...@gmail.com> wrote:
> Hi All,
> We have a Spring Composite that we would like to expose as Web Service using
> Tuscany. The Spring application (Spring + Hibernate) is unaware of SCA and
> the application-context resides in the JAR. Here is what the structure of of
> the MyApp.jar looks like -
>> com.mycompany.account.das...
>> META-INF
>> application-context.xml
>> config.properties
>> spring-dao.xml
> The application-context imports other dependent Spring config already, so if
> I include this MyApp.jar in my classpath in a new eclipse project, I can do
> a quick Java Test in 3 lines as follows -
>
> ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]
> {"application-context.xml"});
>
> BusinessService service = (BusinessService) ctx.getBean("accountService");
>
> service.sayHello("Kunle");
>
> Moving to Tuscany, I have a simple composite as follows -
>
> <component name="AccountManagementServiceComponent">
>
>     <implementation.spring location="./application-context.xml"/>
>
>     <service name="AccountManagementService">
>
>         <interface.java interface="com.mycompany.BusinessService"/>
>
>     </service>
>
> </component>
>
> For some reason, Tuscany cannot resolve the Location of the
> application-context (in a JAR file in the classpath). We keep getting the
> following error -
>
> Exception in thread "main" org.osoa.sca.ServiceRuntimeException:
> org.apache.tuscany.sca.contribution.service.ContributionResolveException:
> org.apache.tuscany.sca.contribution.service.ContributionReadException:
> Location cannot be resloved: /application-context.xml
>
> at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:204)
>
> at
> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassLoader(NodeFactoryImpl.java:37)
>
> We would appreciate any help we can get. This is really holding us back.
>
> Thanks,
>
> Kunle.
>

Does it make any difference if you remove the "./"  from the
implementation.spring in the composite

<implementation.spring location="application-context.xml"/>


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