I have been trying out some examples with apache felix and osgi. I made service (Service provider) interface and implemented it. After that I manage to create a jar file with the relevant information provided through a manifest file. Next I need to crate a jar file for the consumer part. But when ever I try to compile the consumer part it gives an error as package does not exist . I need to import the interface to the consumer (Service consumer).
This is my code (Service Consumer's Activator.java)
package mtitassignmentone.serviceconsumer;
import java.util.Scanner;
import java.util.StringTokenizer;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
**import mtitassignmentone.serviceprovider.service.BookService;**
public class Activator implements BundleActivator {
private BundleContext m_context = null;
private ServiceTracker m_tracker = null;
public void start(BundleContext context) throws Exception {
m_context = context;
// Create a service tracker to monitor dictionary services.
m_tracker = new ServiceTracker(m_context, m_context.createFilter(BookService.class.getName()), null);
m_tracker.open();
BookService book= (BookService) m_tracker.getService();
book.getName();
}
public void stop(BundleContext context) {
}
}
import mtitassignmentone.serviceprovider.service.BookService; it the error that throws when compiling. but that file exist. How to overcome this?