[
https://issues.apache.org/jira/browse/TUSCANY-2027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565399#action_12565399
]
Mark Combellack commented on TUSCANY-2027:
------------------------------------------
I've managed to find the problem. It appears to be in CompositeWireBuilder in
the assembly project.
The code for recursing down through composites for resolving references has
been commented out with a comment that this is no longer required. This is
partially true. If the nesting of composites extends only to one level then it
is not needed. However, if you nest to many levels, it is necessary to recurse
down the composites.
Basically, I am going to uncomment the following code in the
wireCompositeReferences() method of CompositeWireBuilder:
// Process nested composites recursively
for (Component component : composite.getComponents()) {
Implementation implementation = component.getImplementation();
if (implementation instanceof Composite) {
wireCompositeReferences((Composite)implementation);
}
}
I'm doing a local build at the moment to ensure that I have not broken anything
else.
> Problem using implementation.composite that is another
> implementation.composite with promoted references
> --------------------------------------------------------------------------------------------------------
>
> Key: TUSCANY-2027
> URL: https://issues.apache.org/jira/browse/TUSCANY-2027
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Core Runtime
> Affects Versions: Java-SCA-Next
> Environment: svn revision 609904
> Linux
> Reporter: Mark Combellack
> Assignee: Mark Combellack
> Fix For: Java-SCA-Next
>
> Attachments: recursive2.jar
>
>
> I am having problems with a sample application that attempts to use nested
> implementation.composites and references
> I have an application that has:
> A lowest level composite (Called CComposite) that has two promoted references:
> <service name="CService" promote="CComponent">
> <interface.java interface="samples.C"/>
> <binding.sca/>
> </service>
> <reference name="PromotedRefX" promote="CComponent/refX">
> <interface.java interface="samples.X"/>
> <binding.sca/>
> </reference>
> <reference name="PromotedRefY" promote="CComponent/refY">
> <interface.java interface="samples.Y"/>
> <binding.sca/>
> </reference>
> <component name="CComponent">
> <implementation.java class="samples.CImpl"/>
> <reference name="refX"/>
> <reference name="refY"/>
> </component>
> This is then used by another Composite (called BComposite):
> <service name="BService" promote="BComponent">
> <interface.java interface="samples.C"/>
> <binding.sca/>
> </service>
> <component name="BComponent">
> <implementation.composite name="sample:CComposite"/>
> <reference name="PromotedRefX" target="XComponent"/>
> <reference name="PromotedRefY" target="YComponent"/>
> </component>
> <component name="XComponent">
> <implementation.java class="samples.XImpl"/>
> </component>
> <component name="YComponent">
> <implementation.java class="samples.YImpl"/>
> </component>
> This is then used by another composite (called AComposite):
> <service name="AService" promote="AComponent">
> <interface.java interface="samples.C"/>
> </service>
> <component name="AComponent">
> <implementation.composite name="sample:BComposite"/>
> </component>
> I have a unit test that tries to use AComponent. However, when I invoke an
> operation on the Service, I get the following exception:
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running nested.NestedTestCase
> Deployed names = [XComponent, AComponent, BComponent, YComponent, CComponent]
> Setting X on CImpl to [Proxy - [EMAIL PROTECTED]
> Setting Y on CImpl to [Proxy - [EMAIL PROTECTED]
> Deployed names = [XComponent, AComponent, BComponent, YComponent, CComponent]
> Setting X on CImpl to [Proxy - [EMAIL PROTECTED]
> Setting Y on CImpl to [Proxy - [EMAIL PROTECTED]
> Method call returned [C:cOp() - xResult = X:xOp() yResult = Y:yOp()]
> Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.667 sec <<<
> FAILURE!
> testAComponent(nested.NestedTestCase) Time elapsed: 1.434 sec <<< ERROR!
> org.osoa.sca.ServiceUnavailableException: Service not found for component
> CComponent reference refX (bindingURI=null operation=xOp). Ensure that the
> composite containing the service is loaded and started somewhere in the SCA
> domain and that if running in a remote node that the interface of the target
> service marked as @Remotable
> at
> org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAReferenceBindingProvider.createInvoker(RuntimeSCAReferenceBindingProvider.java:225)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.addBindingInterceptor(RuntimeWireImpl.java:213)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.initInvocationChains(RuntimeWireImpl.java:155)
> at
> org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.getInvocationChains(RuntimeWireImpl.java:97)
> at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.getInvocationChain(JDKInvocationHandler.java:205)
> at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:139)
> at $Proxy6.xOp(Unknown Source)
> at samples.CImpl.cOp(CImpl.java:33)
> 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:585)
> at
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:105)
> at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:248)
> at
> org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:145)
> at $Proxy5.cOp(Unknown Source)
> at nested.NestedTestCase.testAComponent(NestedTestCase.java:42)
> 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:585)
> 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.OldTestClassRunner.run(OldTestClassRunner.java:35)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
> 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:585)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:308)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:879)
> Results :
> Tests in error:
> testAComponent(nested.NestedTestCase)
> Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
> I have a second test that looks up BComponent directly and runs the same code
> and this test passes.
--
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]