Using EmbeddedSCADomain to deploy two contribution error
--------------------------------------------------------

                 Key: TUSCANY-1756
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1756
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Assembly Model
    Affects Versions: Java-SCA-1.0
         Environment: jdk 1.5.01,winxp
            Reporter: wangfeng
             Fix For: Java-SCA-1.0


I use EmbeddedSCADomain to deploy two contribution,one contribution 
ready(build,activate,start) ,after that deploy the other contribution,get an 
exception as below:

java.lang.IllegalStateException: Scope must be in UNINITIALIZED or STOPPED 
state [4]
        at 
org.apache.tuscany.sca.core.scope.AbstractScopeContainer.start(AbstractScopeContainer.java:118)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:489)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:427)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:478)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:427)
        at test.ContributionTestCase.setUp(ContributionTestCase.java:79)
        at junit.framework.TestCase.runBare(TestCase.java:128)
        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:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
        
and also when the scopeContainer stop,get an similar exception too.

java.lang.IllegalStateException: Scope in wrong state [6]
        at 
org.apache.tuscany.sca.core.scope.AbstractScopeContainer.stop(AbstractScopeContainer.java:136)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.stop(CompositeActivatorImpl.java:552)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.stop(CompositeActivatorImpl.java:436)
        at test.ContributionTestCase.tearDown(ContributionTestCase.java:106)
        at junit.framework.TestCase.runBare(TestCase.java:136)
        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:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

my java snippet:

ClassLoader cl = getClass().getClassLoader();
EmbeddedSCADomain domain = new EmbeddedSCADomain(cl, "http://localhost";);
domain.start();

ContributionService contributionService = domain.getContributionService();
Contribution helloContribution = 
contributionService.contribute("http://import-export/export-composite";, 
helloContribution_URL, false);
for (Composite deployable : helloContribution.getDeployables()) {
    domain.getDomainComposite().getIncludes().add(deployable);
    domain.getCompositeBuilder().build(deployable);
}
for (Composite deployable : helloContribution.getDeployables()) {
    domain.getCompositeActivator().activate(deployable);
    domain.getCompositeActivator().start(deployable);
}

Contribution helloWorldContribution_one = 
contributionService.contribute("http://import-export/helloworld_one";, 
helloWorldContribution_one_URL, false);
for (Composite deployable : helloWorldContribution_one.getDeployables()) {
    domain.getDomainComposite().getIncludes().add(deployable);
    domain.getCompositeBuilder().build(deployable);
}

for (Composite deployable : helloWorldContribution_one.getDeployables()) {
    domain.getCompositeActivator().activate(deployable);
    domain.getCompositeActivator().start(deployable);
}

hello.composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
        targetNamespace="http://hello";
        xmlns:hello="http://hello";
    name="hello">

    <service name="HelloService" promote="HelloServiceComponent"/>
        
    <component name="HelloServiceComponent">
        <implementation.java class="hello.HelloImpl" />
    </component>

</composite>

helloword_one.composite
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
        targetNamespace="http://helloworld";
        xmlns:helloworld="http://helloworld";
        xmlns:hello="http://hello";
    name="helloworld_one">

    <component name="SourceHelloServiceComponent_one">
       <implementation.composite name="hello:hello"/>
    </component>

    <component name="HelloWorldServiceComponent_one">
        <implementation.java class="helloworld.HelloWorldImpl" />
        <reference name="helloServiceRef" 
target="SourceHelloServiceComponent_one/HelloService"/>
    </component>

</composite>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to