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 <kgbadam...@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 <ramkumar...@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 <kgbadam...@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 
>>> <luckbr1...@gmail.com>wrote:
>>>
>>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <kgbadam...@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

Reply via email to