Hi list !
I'm new to OSGI and iPOJO and I'm trying to create my first
application using these tools with Maven. The purpose of this
application is to test a messaging system accross components
(basically an observer pattern).
The application is composed of 4 bundles :
1) The CoreServices bundle defines service interfaces in two
packages : one for the execution service and one for the messaging
service. The execution package defines just one ExecutionService
interface, while the messaging service defines the MessagingService
and the Message interfaces (plus an Enum Class).
There is no metada.xml file defined for this bundle and the pom.xml
file declares the two packages in the <Export-Package> tag
2) The ExecutionService bundle implements the ExecutionService
interface. The metada.xml file declares the component that <provides /
> the services and creates an instance. The pom file declares the
compilation dependency with the first bundle and declares the impl
package as <Private-Package>
3) The MessagingService bundle implements the MessagingService and the
Message interfaces. The MessageImpl class uses an executionService
field. The metadata.xml file is provided below. The pom.xml file
declares the compilation dependency with the first bundle and declares
the impl package as <Private-Package>
<iPOJO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd
"
xmlns="org.apache.felix.ipojo">
<component classname="myapp.messaging.impl.MessagingServiceImpl"
name="MessagingServiceImpl" public="false">
<provides />
</component>
<component classname="myapp.messaging.impl.MessageImpl"
name="MessageImpl">
<requires field="executionService"/>
</component>
<instance component="MessagingServiceImpl"/>
</iPOJO>
4) The Test bundle implements two classes : a GUI that allows the user
to send messages and a Logger that subscribes the message and prints
"Hello World" when received.
I manage to build and launch the application without any problem. The
arch command confirms that all my instances are valid. However, when I
click the "send message" button, I have a null pointer exception on
the executionService field in the MessageImpl class.
What did I do wrong ? Do I need to split the CoreServices bundle into
two bundles (one declaring the execution service and the other one the
messaging service ?)
I also tryed to launch all bundles except the ExecutionService bundle,
and even though the MessagingService bundle requires it, arch tells me
its instance is valid and the application is correctly launched.
Thanks for your help,
Benoît
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]