Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Bundle configuration for an OSGi application
Bundle configuration for an OSGi application [message #1816834] Fri, 08 November 2019 00:17 Go to next message
Eclipse UserFriend
I run Eclipse 2019-09 in the Modeling edition and created a "Hello OSGi Bundle" demo application using the plug-in project creation wizard. This is its MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Hello
Bundle-SymbolicName: my.hello
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: my.hello.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.osgi.framework;version="1.3.0"
Automatic-Module-Name: my.hello
Export-Package: my.hello

(1) With the following run configuration, I am able to execute the simple OSGi application and interact with it using the console:
index.php/fa/36728/0/

However, although the configuration comprises only a few bundles, a large number of OSGi bundles seems to be executed:
osgi> ss
"Framework is launched."


id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.15.0.v20190830-1434
1	ACTIVE      my.hello_1.0.0.qualifier
2	ACTIVE      com.ibm.icu.source_64.2.0.v20190507-1337
3	ACTIVE      com.jcraft.jsch.source_0.1.55.v20190404-1902
4	ACTIVE      com.sun.el.source_2.2.0.v201303151357
5	ACTIVE      javax.annotation.source_1.2.0.v201602091430
[...]
538	ACTIVE      org.w3c.css.sac.source_1.3.1.v200903091627
539	ACTIVE      org.w3c.dom.events.source_3.0.0.draft20060413_v201105210656
540	ACTIVE      org.w3c.dom.smil.source_1.0.1.v200903091627
541	ACTIVE      org.w3c.dom.svg.source_1.1.0.v201011041433

Apart from the bundles that are actually necessary, the name of all the others seem to be "source" bundles. However, I wonder why Eclipse adds all these bundles to the run. Is there any way to prevent it from doing so?

(2) As shown in the above figure, Eclipse considers this a "valid" configuration. However, if I click the "Add Required Bundles" button in the dialog, Eclipse adds a large amount of bundles to the configuration:
index.php/fa/36729/0/
It also does this with the "Include optional dependencies..." option disabled. I am also unable to understand how Eclipse calculates these dependencies. Where are they drawn from? Some of these dependencies causes the application to output messages like the following:
!ENTRY org.eclipse.equinox.registry 2 0 2019-11-08 01:11:39.795
!MESSAGE The extensions and extension-points from the bundle "org.eclipse.emf.validation.ui.ide.source" are ignored. The bundle is not marked as singleton. 

Is it possible to configure Eclipse sucht that it adds only the bundles that are actually necessary?
Re: Bundle configuration for an OSGi application [message #1817144 is a reply to message #1816834] Sat, 16 November 2019 06:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This isn't really a JDT question; it certainly involve PDE as well...

In the end, all dependencies are computed from what's specified in the MANIFEST.MF of each plug-in (p2.inf files can also impact this) and both the workspace and target platform are sources for resolving these dependencies. It's not generally trivial to arrive at a minimal set of plug-ins for a launch. If you don't want the sources (you certainly won't need them in the runtime launch), you could filter for those, and deselect them.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Bundle configuration for an OSGi application [message #1817150 is a reply to message #1817144] Sat, 16 November 2019 08:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
HI

If your goal is something really small then you want to use standalone rather than OSGI. [1] demonstrates that you can run real UML2 applications with about 18 classpath entries.

If you really want OSGI, then you can use the show the plugin dependency hierarchy on the Dependencies tab of the MANIFEST.MF editor to see all the dependents of each plugin you specify. It looks as if you have chosen some with perhaps rather bloated dependencies. Try specifying just what you need.

(The unwanted source dependencies may be a side effect/bug caused by the change in build policies required/supported by Tycho. We used to have low level streamlined source-free features and high-level helpful with-source features. Now Tycho prefers distinct, regular source-free/Developer Resources for every plugin/feature causing confusion with legacy build configurations.)

Regards

Ed Willink

[1] https://ci.eclipse.org/ocl/job/ocl-uml-standalone/81/console
Re: Bundle configuration for an OSGi application [message #1817154 is a reply to message #1817150] Sat, 16 November 2019 15:34 Go to previous message
Eclipse UserFriend
Thank you very much for your helpful answers!

I agree that the forum on PDE-related questions would indeed be a better fit for this topic. My apologies.

Right now, my primary goal is not to build an explicitly small Java application. I am rather trying to develop an understanding of how Eclipse plug-in development works from the ground up. This is why I am a little bit confused with the "magic" that happens during the launch of an OSGi application.

Ed Merks wrote on Sat, 16 November 2019 06:43
If you don't want the sources (you certainly won't need them in the runtime launch), you could filter for those, and deselect them.

Unfortunately, the "sources" bundles are not listed in the "Bundles" tab of Run Configuration dialog. Is there maybe another location that I need to check?

Ed Willink wrote on Sat, 16 November 2019 08:40
If you really want OSGI, then you can use the show the plugin dependency hierarchy on the Dependencies tab of the MANIFEST.MF editor to see all the dependents of each plugin you specify. It looks as if you have chosen some with perhaps rather bloated dependencies. Try specifying just what you need.

Thank you for the hint. Taking a look at the plug-in dependency hierarchy of the "my.hello" bundle, I can see that the only listed dependency is "org.eclipse.osgi", which itself has a dependency on "org.eclipse.osgi.compatibility.state". Nevertheless, the "Add Required Bundles" button adds a large number of bundles to the run. Do you have any idea where Eclipse might get them from?
Previous Topic:Trouble Installing Eclipse
Next Topic:Eclipse "forgets" existence of class
Goto Forum:
  


Current Time: Thu Apr 25 13:30:15 GMT 2024

Powered by FUDForum. Page generated in 0.03430 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top