I'm just starting with OSGi and Eclipse RCP.
Could someone explain to me the difference between "Eclipse" and "Equinox" as the target platform, when creating a new eclipse plugin project?
I still know that Equinox is Eclipse's implementation of OSGi.
I read in some articles that eclipse rcp is also based on Equinox. So where is the difference between the target platform you have to choose in a new Eclipse Plugin Project?
Best regards
Choosing "an OSGi framework":
This simply creates a new bundle with no required plug-ins or imported packages (unless you choose an activator in which case the org.osgi.framework package shows up under imported packages).
Choosing Eclipse version:
After clicking next the wizard gives you the checkbox "This plug-in will make contributions to the UI" and allows you to create a rich client application
Without any other options an Eclipse plugin will have org.eclipse.core.runtime as a required plugin. If you say the plug-in will make contributions to the UI then org.eclipse.ui is added to required plug-ins. By saying you want to create a rich client application the Templates are different on the final screen and you are forced to choose one to finish. Also your Activator will extend Plugin if you did not choose the UI option and AbstractUIPlugin if you did choose the UI option.
There is nothing different about the bundles that are created in either manner, the wizard just sets up some default required plug-ins/imported packages for you. Of course as VonC pointed out some of the dependencies setup by the Eclipse route may not be compatible with other OSGi implementations.
It is about the environement in which the module you will be creating will run: see this
Vogalla's RCP Tutorial
Vogella's OSGi with Eclipse Equinox
Eclipse Equinox is the runtime environment on which the Eclipse IDE and Eclipse RCP application are based.
In Eclipse the smallest unit of modularization is a plugin. The terms plugin and bundle are (almost) interchangable. An Eclipse plugin is also an OSGi bundle and vice versa.
bundle for OSGi, able to run in the Equinox framework (within or outside of Eclipse)
plugin for Eclipse, to run within an Eclipse-based application.
See Equinox Quick Start Guide:
The Equinox OSGi framework implementation forms the underpinnings of the Eclipse RCP and IDE platforms but it is in fact a fully standalone OSGi implementation.
You can run a bundle independently from Eclipse:
java -jar org.eclipse.osgi_3.2.0.jar -console
Once this is running you will see an osgi> prompt. This is the OSGi console waiting for you to type commands
Related
I'm unable to successfully add and use these external jars from my Eclipse Repository.
org.apache.felix.dependencymanager.annotation-4.0.3
org.apache.felix.dependencymanager.runtime-4.0.2
org.apache.felix.dependencymanager.shell-4.0.3
org.apache.felix.dependencymanager-4.2.0
I get no errors at the Add Files to Repository window:
I, however, get an error warning pop-up window after clicking on the Finish button.
'Building Workspace' has encountered a problem
Errors occured during the build.
I then get the error below whenever I add them from the Available Bundles tab into the Run Requirements tab and then try to resolve the Run Requirements (even though I have added all the jar).
org.osgi.service.resolver.ResolutionException: Unable to resolve <<INITIAL>> version=null: missing requirement org.apache.felix.dependencymanager
How can I successfully add and use these jar files to my project?
Eclipse
Eclipse Java EE IDE for Web Developers.
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200
Java:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Eclipse Equinox is the OSGi framework developed in the frame of the Eclipse foundation. Deploying on the Eclipse platform means deploying OSGi bundles in Equinox.
You are using Apache Felix, which is the OSGi framework developed in the frame of the Apache foundation.
According to your explanations, it seems you are trying to install Felix as an Eclipse bundle:
[...]add and use these external jars from my Eclipse Repository.
If you wish to develop an Eclipse project which would be deployed as an OSGi bundle in the Apache Felix framework (and not an Eclipse plug-in project), the Felix Documentation details how to integrate Apache Felix with the Eclipse IDE. It seems in this documents snapshot are out of order, but the general procedure should be right. Three ways to include the Felix runtime are specified, an Eclipse repository does not seem to be the right way.
My Problem is .....
I have a OSGi Software and I try to combine into Eclipse as a plug-in.
Is that possible to create a Eclipse plug-in UI (just like a button/menu in Eclipse) to trigger a OSGi platform?
Thanks.
An Eclipse plug-in would allow you to insert the Button feature. Here you have a tutorial, however...
Eclipse is itfself built on top of an OSGi framework: Equinox. Of course, you could embed an OSGi platform such as Knopflerfish or Apache Felix inside, but this would be a doubtful architecture.
An Eclipse plug-in is itself an OSGi bundle, defined in a standard way with the MANIFEST.MF file. In order to complete the standard modularity management feature with an explicit dependency management, Eclipse has its own system relying on the plugin.xml file (a kind of glue). You should be able to load all your existing OSGi bundle (non-plug-in) as if these where plugins. If I am not mistaken, the plugin.xml file is not required for a plug-in. Here is an exchange in the Eclipse forum on the topic.
According to this post, IDEA uses Osmorc to run OSGi frameworks. It, in turn, uses Pax Runner to launch different framework implementations.
The toolchain in IDEA 11 can only run Apache Felix up to 3.0.2, but I have to run version 4.0.2. Is it possible? Do other OSGi framework launchers exist for IDEA?
You can configure the OSGI frameworks that Osmorc uses from the plugin+ project settings.
I use IntelliJ IDEA 11.1.2 and Osmorc 1.4.2.
Here is a screenshot where I configure the OSGI container (at IDE Settings-->OSGi) to some local
installation of Apache Felix 4.0.1.
You can also define your custom framework/container and then select the desired
OSGI framework to use at Project Settings-->OSGI as seen below:
In order to create Run configurations, you first need to create some OSGi facets.
Hopefully, you are also using maven and the maven-bundle-plugin which will greatly
reduce the amount of configuration you need to do(since OSmorc automatically syncs with your pom.xml), but even if you do not, you can manually edit the information for creating the bundles.
So, what you need to do next is create some OSGi facets. Go to Project "Structure-->Facets"
and add a new OSGi facet for each bundle you wish to create. It you have automatic detection turned on, then the facets maybe already there. If not, then add them manually and then configure them as you see appropriate, like in the following example.
Finally edit your "Run Configurations" and add a new OSGi run configuration.
Select the framework you wish to use and the bundles you wish to start as well as
other parameters, like in the following example:
I'm currently developing a maven osgi bundle using Netbeans 7.1. While its easy to create new maven osgi bundle project from netbeans, I've been struggling about how I would run it. Simply running it from netbeans gives me an error that tells me there is missing requirement (missing slf4j for example).
Then I tried a different way. I ran equinox in a terminal and then manually install my project jar to it. But then I must also resolve all the dependencies manually.
Is there any way to automatically download all the required dependencies from an OSGI bundle and install it to a running OSGI framework?
thanx before
AFAIK there's no automation for OSGi in Netbeans (though I may well be wrong). The support you may have seen in Eclipse is only for Eclipse plugins not vanilla OSGi.
Your best bet is to go for some integrating testing or launch via a maven goal, pax-exam or bndtools or even pax-runner will allow you to launch from IDE/maven.
However I don't know of anything that will automatically resolve all dependencies (transitive dependencies and implementations of APIs you depend on would be problematic)
Its a big pain, no question about it. What I used to do was to do a full build (and if you've configured your manifests correctly should include all necessary dependencies) which will generate the necessary jar. I then wired my Tomcat to pick up the jar from my target repository and configured it to hotswap automatically.
Its a matter of preference if you want to run your app server from within your netbeans but I preferred to execute a separate instance of tomcat outside of my IDE. It'll work either way tho.
I've developed an osgi application (no rcp) using eclipse. It consists of several Plugin-Projects-Bundles and dependencies from eclipse plugins folder (commons.* ...)
The application works fine when launched using eclipse.
What is the best way to export and deploy such an application from eclipse? Is there a simple way to export my launch configuration?
All I found was for rcp projects.
All you need to do is religiously fill your Manifest.MF via PDE(Plugin Editor), you must
Add proper plugin-dependencies in the Dependecies tab in PDE
Fill the Classpath and Exported Packages in the Runtime tab
And most importantly, make sure in the Build tab you have checked on the required resources to be exported.
Its very important to note point 3, it is here where most people make mistake and wonder why the project is running perfectly in Eclipse but doesent run when exported.
Right-Click on your
project->Export->Plugin-Development->Deployable
Plugins and Fragments
Check out Chapter 9 on packaging OSGi/Equinox applications in the new OSGi and Equinox book. It's available on rough cuts now: http://my.safaribooksonline.com/9780321561510. It should be available in print for purchase by EclipseCon in March.
Creating an OSGi bundle, by itself, does not constitute a complete application. OSGi bundles require a container and its the container's responsibility to manage the lifetime of the bundle: loading the bundle, resolving dependencies, invoking the bundle's activator, etc. There are several OSGi containers available such as Knopflerfish (http://www.knopflerfish.org/), Felix (http://felix.apache.org/), and Equinox (http://www.eclipse.org/equinox/). Internally, Eclipse uses Equinox.
Deploying an application that uses OSGi entails configuring the container and the exact mechanism for doing that depends on the chosen container. If you wish to continue using Equinox then check out this quick-start guide for configuring and launching the container outside Eclipse (http://www.eclipse.org/equinox/documents/quickstart.php).
PDE generates a configuration that can be customized much easier that writing an Equinox config from scratch. In your running Eclipse-based OSGi environment, type bundles. You'll see where Equinox is putting all the runtime bundles for the launch. In there should be a config.ini that PDE is generating for the launch. In my case it's [workspace root]/.metadata/.plugins/org.eclipse.pde.core/[My Launch Config Name]/config.ini.
-> Create a feature project in Eclipse
-> Open feature.xml file of the created project.
-> Add all the required Plug-ins and dependencies under "Included Plug-ins"
-> Ensure that you have added all OSGI dependant "Plug-ins"
Here is a list of Plug-in I am using
-> Now create the OSGI run configuration
-> Under "Bundles", select your feature project.
Now all the plug-ins can be exported from the Overview tab of your feature.xml