On Mon, Apr 26, 2010 at 7:43 PM, Juan Pablo Pizarro
<juanpablo.piza...@gmail.com> wrote:
> Hello Simon!, I'm trying to run a example that saw in the documentation. I
> write restaurant application, services, etc. I write a test case to run the
> application and I found a error:
>
> org.oasisopen.sca.ServiceRuntimeException: No SCA contributions are found on
> the classpath
>     at
> org.apache.tuscany.sca.node.NodeFactory.createNode(NodeFactory.java:289)
>     at
> com.casa.comp.restaurant.RestaurantTest.testService(RestaurantTest.java:18)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at junit.framework.TestCase.runTest(TestCase.java:168)
>     at junit.framework.TestCase.runBare(TestCase.java:134)
>     at junit.framework.TestResult$1.protect(TestResult.java:110)
>     at junit.framework.TestResult.runProtected(TestResult.java:128)
>     at junit.framework.TestResult.run(TestResult.java:113)
>     at junit.framework.TestCase.run(TestCase.java:124)
>     at junit.framework.TestSuite.runTest(TestSuite.java:232)
>     at junit.framework.TestSuite.run(TestSuite.java:227)
>     at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
> My test case:
>
>    public void testService() throws Exception {
>
>         Node node =
> NodeFactory.newInstance().createNode("Restaurant.composite").start();
>         RestaurantService restaurantService =
> node.getService(RestaurantService.class, "RestaurantServiceComponent");
>
>         Menu[] menus = restaurantService.getMenus();
>
>         System.out.println("--- Menu ---");
>         for (Menu m : menus) {
>             System.out.println("- " + m.printMenu());
>         }
>
>         System.out.println();
>         Menu menu = menus[3];
>
>         System.out.println("My choice: " + menu.printMenu());
>         System.out.println();
>
>         double price = restaurantService.getBill(menu);
>         System.out.println("Price (" + menu.printMenu() + "): " + price);
>     }
>
>
> Then I read that the application would be runned in a application server
> (OSGI specs compliant). Then I start to configure the application and I miss
> the launcher main class.
>
>   http://wiki.eclipse.org/STP/SCA_Component/SCA_Java_Run_and_Debug_Tuscany
>
> So.. I need some guide to follow. I continue reading google things to fix my
> configuration.
>
> Thanks!
>
> JP
>
>
>
>
>
>
> 2010/4/26 Simon Laws <simonsl...@googlemail.com>
>>
>> On Mon, Apr 26, 2010 at 2:20 PM, Juan Pablo Pizarro
>> <juanpablo.piza...@gmail.com> wrote:
>> > Hi all, i'm rookie in tuscani and i need a guide or documentation. I saw
>> > the
>> > documentation that exists in the site, but is over old versions. I
>> > bought a
>> > book to get concepts and it is a good book, but again is based on old
>> > version.
>> >
>> > Have anybody a document or link about tuscani 2.x tutorial?. I use
>> > eclipse
>> > and trying to use tuscani 2.x within eclipse.
>> >
>> > Thanks..
>> >
>> > JP
>> >
>>
>> Hi
>>
>> Our 2.x documentation [1] is lacking in intro and sample material at
>> the moment. A number of samples that the 1.x intro material is based
>> on have been ported over into the 2.x code base but the docs haven't
>> followed yet. If you're having specific problems with Eclipse post the
>> details here and we'll try and help out.
>>
>> [1] http://tuscany.apache.org/documentation-2x/
>>
>> Simon
>> --
>> Apache Tuscany committer: tuscany.apache.org
>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>
>

Hi JP

Where is the file "Restaurant.composite" relative to the module that
you are using to develop the test case? Tuscany is trying to find a
contribution by looking for this file on the classpath.

An SCA contribution is a hierarchical set of information such as
composite files, WSDLs, XSDs etc that are required to run your SCA
application. It could be a directory structure, a zip, a jar etc. When
you create the node you have to tell it which contribution to load.
If, for example, you look in the CalculatorTestCase of the 2.x
Calculator sample you see the following...

        node = NodeFactory.newInstance().createNode((String)null, new
String[] {"target/classes"}).start();
        calculatorService = node.getService(CalculatorService.class,
"CalculatorServiceComponent");

Here we loading the whole of the ./target/classes directory as the
contribution. We do this as this sample is build using Maven and this
is where Maven puts all the compiled Java classes and resources by
default.

Are you able to successfully run the Calculator sample?

Regards

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to