dear graham,
i fixed the build file and also set the system property to a
felix.configuration-file. the output i get now is as follows. it seams
that the ds-support is working, but there is still a problem with missing
classes. is this a classloader issue?
regards,
frank
run:
[java] Main thread Thread[main,5,main]
[java] *DEBUG* Scheduling task ManagedService Update:
pid=CustomerComponent
[java] *DEBUG* Running task ManagedService Update: pid=CustomerComponent
[java] ERROR: ds.supplychain.customer.Customer (5):
[CustomerComponent] Cannot load class used as parameter
supplychain.retailer.Retailer
[java] java.lang.ClassNotFoundException: supplychain.retailer.Retailer
[java] at
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1504)
[java] at org.apache.felix.framework.Felix.loadClass(Felix.java:596)
[java] at
org.apache.felix.scr.impl.DependencyManager.getBindingMethod(DependencyManager.java:735)
[java] at
org.apache.felix.scr.impl.DependencyManager.invokeBindMethod(DependencyManager.java:828)
[java] at
org.apache.felix.scr.impl.DependencyManager.bind(DependencyManager.java:651)
[java] at
org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:203)
[java] at
org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:133)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:476)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.enableInternal(AbstractComponentManager.java:398)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.access$000(AbstractComponentManager.java:36)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager$1.run(AbstractComponentManager.java:99)
[java] at
org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
[java] ERROR: ds.supplychain.customer.Customer (5):
[CustomerComponent] Cannot load class used as parameter
supplychain.retailer.Retailer
[java] java.lang.ClassNotFoundException: supplychain.retailer.Retailer
[java] at
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1504)
[java] at org.apache.felix.framework.Felix.loadClass(Felix.java:596)
[java] at
org.apache.felix.scr.impl.DependencyManager.getBindingMethod(DependencyManager.java:735)
[java] at
org.apache.felix.scr.impl.DependencyManager.getBindingMethod(DependencyManager.java:794)
[java] at
org.apache.felix.scr.impl.DependencyManager.invokeBindMethod(DependencyManager.java:828)
[java] at
org.apache.felix.scr.impl.DependencyManager.bind(DependencyManager.java:651)
[java] at
org.apache.felix.scr.impl.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:203)
[java] at
org.apache.felix.scr.impl.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:133)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.activateInternal(AbstractComponentManager.java:476)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.enableInternal(AbstractComponentManager.java:398)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager.access$000(AbstractComponentManager.java:36)
[java] at
org.apache.felix.scr.impl.AbstractComponentManager$1.run(AbstractComponentManager.java:99)
[java] at
org.apache.felix.scr.impl.ComponentActorThread.run(ComponentActorThread.java:85)
[java] ERROR: ds.supplychain.customer.Customer (5):
[CustomerComponent] bind() method not found
[java] Exception in thread "main" java.lang.NullPointerException
[java] at
supplychain.customer.OSGiCustomerComponentImpl.purchaseGoods(OSGiCustomerComponentImpl.java:42)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at
org.apache.tuscany.sca.implementation.osgi.invocation.OSGiTargetInvoker.invokeMethod(OSGiTargetInvoker.java:173)
[java] at
org.apache.tuscany.sca.implementation.osgi.invocation.OSGiTargetInvoker.invokeTarget(OSGiTargetInvoker.java:145)
[java] at
org.apache.tuscany.sca.implementation.osgi.invocation.OSGiTargetInvoker.invoke(OSGiTargetInvoker.java:190)
[java] at
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
[java] at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:287)
[java] at
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
[java] at $Proxy7.purchaseGoods(Unknown Source)
[java] at
supplychain.SupplyChainClient.main(SupplyChainClient.java:41)
[java] Java Result: 1
> Hi Frank,
>
> I've not been able to run the osgi supplychain sample due to other
> reasons, but during my investiguations I spotted the following in the
> build.xml file
>
> <jar jarfile="target/classes/DSRetailer.jar"
> manifest="target/classes/osgi/ds/Retailer.mf" >
> <fileset dir="target/classes"
> includes="supplychain/retailer/Retailer.class \
> Vosgi/ds/Retailer.xml \
>
> supplychain/retailer/OSGiRetailerComponentImpl.class"
> />
>
> You'll see that there is a spurious "V" at the start of the forth
> line, which should not be there. This is line 78 in the file.
>
> Also, looking at your exception, the OSGi runtime used to host the
> implementation.osgi components appears to be missing the declarative
> services support. This is added through a config file, which in the
> case of this sample does not appear to exist. Look for files call
> felix.config.properties for examples. You would also need to set the
> system property felix.config.properties to point to your configuration
> file. The line which configures in the Service Component Runtime for
> itest/osgi-implementation is
>
> felix.auto.start.1= \
>
> "file://${FELIX_DIR}/org.apache.felix.scr/1.0.2/org.apache.felix.scr-1.0.2.jar"
> \
>
> "file://${FELIX_DIR}/org.apache.felix.configadmin/1.0.1/org.apache.felix.configadmin-1.0.1.jar"
>
> If you look for files call OSGiTestUtil.java , they show the System
> property being configured like this:
>
> String felixConfigFileName =
> "file:target/test-classes/osgi/felix/felix.config.properties";
> System.setProperty("felix.config.properties",
> felixConfigFileName);
>
> I think this sample needs a bit of an overhaul. I hope this helps.
>
> Regards, Graham.