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

Calling OSGi Service with SDO data

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Java-SCA-1.2
    • Java-SDO-Next
    • None
    • Windows XP, Java Tuscany Sca runtime

    Description

      Hi,
      I am trying to call an OSGi service from my sca java service running in the Tuscany SCA runtime. I uses the itest\osgi-implementation sample for SDO as my osgi service and calls the getGreetings method with SDO data as the input parameter for this call.

      I am reusing the HelloWorldService.jar which is in the itest\osgi-implementation folder for my OSGi service component. The composite file of my java service is something like as shown below.

      <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://com.siemens.hintegration"
      xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
      xmlns:hw="http://com.siemens.hintegration" name="motionreactorComposite">
      <dbsdo:import.sdo factory="com.siemens.hintegration.sdo.MotionReactorFactory" />
      <component name="MotionReactorServiceComponent">
      <implementation.java class="com.siemens.hintegration.MotionReactorImpl" />
      <service name="MotionReactorService">
      <interface.java interface="com.siemens.hintegration.MotionReactorService"/>

      <!-JMS Binding->
      <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
      jndiURL="tcp://localhost:61616">
      <destination name="activemq/queue/sendQueue" create="always"/>
      </binding.jms>
      </service>

      <!-- Reference to the OSGi Service -->
      <reference name="helloWorldService" target="OSGiHelloWorldServiceComponent" />
      </component>

      <component name="OSGiHelloWorldServiceComponent">
      <implementation.osgi xmlns="http://tuscany.apache.org/xmlns/sca/1.0"
      bundleSymbolicName="ds.helloworld.sdo.HelloWorldService"/>
      </component>

      </composite>

      The actual code in my java component where I make the call to OSGi service is as follows:
      // Call the OSGi service
      Name name = HelloworldFactory.INSTANCE.createName();
      name.setFirst(firstName);
      name.setLast(lastName);
      String hello = helloWorldService.getGreetings(name);
      getLogger().info("OSGi iTest Sample Call: " + Hello);
      getLogger().info("OsgiService called");

      In the debug mode when the call reaches the OSgi component, I get a illegal argument exception. The error log looks like as shown below.

      • Exception occured while calling OSGi service

      java.lang.IllegalArgumentException: argument type mismatch

      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.osgi.invocation.OSGiTargetInvoker.invokeMethod(OSGiTargetInvoker.java:171)

      at org.apache.tuscany.sca.implementation.osgi.invocation.OSGiRemotableInvoker.invokeMethod(OSGiRemotableInvoker.java:75)

      at org.apache.tuscany.sca.implementation.osgi.invocation.OSGiTargetInvoker.invokeTarget(OSGiTargetInvoker.java:143)

      at org.apache.tuscany.sca.implementation.osgi.invocation.OSGiTargetInvoker.invoke(OSGiTargetInvoker.java:188)

      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:103)

      at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)

      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:103)

      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)

      at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)

      at $Proxy8.getGreetings(Unknown Source)

      at com.siemens.hintegration.MotionReactorImpl.getGreetings(MotionReactorImpl.java:178)

      at com.siemens.hintegration.MotionReactorImpl.onMotionDetected(MotionReactorImpl.java:111)

      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:109)

      at org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:108)

      at org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:110)

      at org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:85)

      at org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(RuntimeWireInvoker.java:79)

      at org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWireImpl.java:134)

      at org.apache.tuscany.sca.binding.jms.provider.JMSBindingListener.invokeService(JMSBindingListener.java:114)

      at org.apache.tuscany.sca.binding.jms.provider.JMSBindingListener.onMessage(JMSBindingListener.java:67)

      at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:854)

      at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:99)

      at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:166)

      at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:117)

      at org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunner.java:26)

      at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:44)

      at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)

      at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)

      at java.lang.Thread.run(Unknown Source)

      Regards
      Roshan

      Attachments

        Activity

          People

            Unassigned Unassigned
            roshanjose Roshan Joseph
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: