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/%3cacac0e3516134e2686e8f55185b1e...@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 <[email protected]>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 <[email protected]> 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 <[email protected]>wrote: >> >>> No, I tried that and it still can't find it. >>> >>> >>> >>> >>> On Wed, Oct 21, 2009 at 11:36 PM, Luciano Resende >>> <[email protected]>wrote: >>> >>>> On Wed, Oct 21, 2009 at 8:11 PM, Kunle Gbadamosi <[email protected]> >>>> 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 >> > >
