You shouldn't add Service-Component header unless you decide to use OSGi
Declarative Service for your OSGi programming.
From: Santiago Miguel Aranda Rojas
Sent: Tuesday, June 16, 2009 8:36 AM
To: [email protected]
Subject: Re: Fwd: Problem with "implementation.osgi" reference
I have done some tests and I have found one problem when I add
Service-Component: OSGI-INF/prueba-component.xml to the manifest.mf of
CalculatorService. I obtain the next error
Caused by: java.lang.NullPointerException
at
org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.init(NodeFactoryImpl.java:256)
at
org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl.access$0(NodeFactoryImpl.java:224)
at
org.apache.tuscany.sca.node.osgi.impl.NodeFactoryImpl$NodeImpl.<init>(NodeFactoryImpl.java:568)
I have downloaded the source code of tuscany in order to see NodeFactoryImpl
class. I have seen this code but I dont know why it is not working.
// Create a monitor
MonitorFactory monitorFactory =
utilities.getUtility(MonitorFactory.class);
monitor = monitorFactory.createMonitor();
I guess "monitorFactory" variable it is null. I have checked if
org.apache.tuscany.sca.monitor is active and it is.
This is my prueba-component.xml
<component name="Prueba" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
<implementation class="es.amivital.calculatorservice2.CalculatorService"
/>
<service>
<provide
interface="es.amivital.calculatorservice2.CalculatorServiceImpl"/>
</service>
</component>
Thank you very much