Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-1930

Wire specified in composite file not working

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Java-SCA-1.0, Java-SCA-1.0.1, Java-SCA-1.1
    • Java-SCA-1.1
    • None
    • jre1.5.0_11 and jre1.6.0_03
    • Patch Available

    Description

      When using a wire in my own composite file I got the error message and stack trace as specified further down.
      After debugging the source code of the SCA Assembly Model component I found that this error can easily be reproduced by modifying the existing integration test:

      org.apache.tuscany.sca.itest.WireTestCase.java

      This integration test does run successful but will fail when one makes the following changes in the accompanying WireTest.composite file:

      Chnage:
      <component name="WireService">
      <implementation.java class="org.apache.tuscany.sca.itest.WireServiceImpl"/>
      </component>
      <wire source="WireClient/aWireService" target="WireService/WireService"/>

      into:
      <component name="WireServiceComponent">
      <implementation.java class="org.apache.tuscany.sca.itest.WireServiceImpl"/>
      </component>
      <wire source="WireClient/aWireService" target="WireServiceComponent/WireService"/>

      Notice the change of the component name. The bug in the code is such that the wire will only work when the component and service name, specified in the target of the wire (i.e. target="WireService/WireService) are equal. As is the case in the current integration test. When the component name and service name are different the wire will fail.

      I was able to fix the bug by modifying one line in the file: org.apache.tuscany.sca.assembly.builder.impl.CompositeWireBuilderImpl.java
      I have attached this as a patch.
      I will also create a new issue in Jira proposing to modify the integration test in order to detect this bug.

      However, I am not entirely sure whether this fix doesn't break other things. The code preceding the line of of code I modified is rather suspicious:

      // Resolve the target service
      ComponentService target = wire.getTarget();
      if (target != null && target.isUnresolved()) {
      resolvedService = componentServices.get(target.getName());
      if (resolvedService != null) {
      wire.setTarget(target);

      The last line doesn't really do anything useful. So maybe this code needs refactoring ...

      >>> Error message:

      5-dec-2007 14:03:33 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
      WARNING: Component reference target not found, it might be a remote service: WireService

      >>> Stack trace:

      org.osoa.sca.ServiceUnavailableException: No service invoker is available for reference aWireService (bindingURI=null operation=sayHello).
      at org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAReferenceBindingProvider.createInvoker(RuntimeSCAReferenceBindingProvider.java:192)
      at org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.addBindingInterceptor(RuntimeWireImpl.java:214)
      at org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.initInvocationChains(RuntimeWireImpl.java:156)
      at org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.getInvocationChains(RuntimeWireImpl.java:97)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.getInvocationChain(JDKInvocationHandler.java:190)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:124)
      at $Proxy7.sayHello(Unknown Source)
      at org.apache.tuscany.sca.itest.WireClientImpl.runTests(WireClientImpl.java:46)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:105)
      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:49)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
      at $Proxy6.runTests(Unknown Source)
      at org.apache.tuscany.sca.itest.WireTestCase.testWire(WireTestCase.java:46)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at junit.framework.TestCase.runTest(TestCase.java:164)
      at junit.framework.TestCase.runBare(TestCase.java:130)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:120)
      at junit.framework.TestSuite.runTest(TestSuite.java:230)
      at junit.framework.TestSuite.run(TestSuite.java:225)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      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)

      Attachments

        Activity

          People

            svkrish S Venkatakrishnan
            averberne Andy Verberne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment