Posts

Showing posts with the label OSGI

OSGi for Beginners

Image
Open Services Gateway initiative framework (OSGi) 1. What is OSGi ?   OSGi is a specification. The core of the OSGi specification defines a component and service model for Java. The components and services can be dynamically activated, de-activated, updated and de-installed. A very practical advantage of OSGi is that every bundle must define its exported Java packages and its required dependencies. This way you can effectively control the provided API and the dependencies of your plug-ins. OSGi bundles : The OSGi specification defines the OSGi bundle as the unit of modularization. A bundle is a cohesive, self-contained unit, which explicitly defines its dependencies to other modules and services. It also explicitly defines its external API. Technically OSGi bundles are .jar files with additional meta information. This meta  information is stored in the "META-INF" folder in the "MANIFEST.MF" file. bundle = identity & dependency info + jar The "MANIFE...

java.lang.IllegalStateException: "Workbench has not been created yet"

I’ve been working with OSGi for quite awhile and have faced a problem "Workbench has not been createt yet" issues. I was getting this error, When i was trying to run OSGI plugin from Eclipse and I guess many of you must have face this problem. So i am writing a little bit about how to resolve this issue so others don’t repeat the same mistakes. From a good article on eclipsezone: java.lang.IllegalStateException: Workbench has not been created yet This usually comes when someone tries to run a Java application against an OSGi bundle with java -classpath .... . It really means that the workbench plug-in hasn't started yet, and so calls to getWorkbench() fail. This is essentially a race condition, and can be solved by either expressing an explicit dependency on that bundle or bumping up that bundle to a higher start level than the workbench. Generally not seen, but if it is, that's what's happening. Now to set the bundle to a higher start level than the work...