Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Cannot attach a fragment to the system bundle.
Cannot attach a fragment to the system bundle. [message #130030] Wed, 29 April 2009 07:04 Go to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

Hi,

some ages ago, Tom Wilson posted an article to this newsgroup,
explaining, that the recommended way to get access to packages on the
classpath is to create a fragment bundle, let it export the required
packages and attach it to the system.bundle (Original post was:
http://dev.eclipse.org/newslists/news.eclipse.technology.equ inox/msg03760.html).
This should be preferred over using a * in the bootdelegation property.

I did the exact thing, i created a bundle with the follwing manifest:

Manifest-Version: 1.0.0
Bundle-ManifestVersion: 2
Bundle-Version: 1.0.0
Bundle-SymbolicName: de.insomniahq.peroxidej.system
Fragment-Host: system.bundle
Bundle-Version: 1.0
Export-Package: com.sun.java.swing.plaf.windows,javax.swing,apple.laf

Now when i start that bundle up in Equinox, it goes into installed
state, but is not attached to the system.bundle:

bundle 19
initial@file://Users/kork/devel/java/peroxIDE-J/classes/prod uction/peroxIDE-system.jar
[19]
Id=19, Status=INSTALLED Data
Root=/Users/kork/Library/Caches/IntelliJIDEA8x/osmorc/runtmp 1240988474979/fwDir/org.eclipse.osgi/bundles/19/data


No registered services.
No services in use.
Exported packages
com.sun.java.swing.plaf.windows; version="0.0.0"[exported]
javax.swing; version="0.0.0"[exported]
apple.laf; version="0.0.0"[exported]
No imported packages
No host bundles
No named class spaces
No required bundles


Therefore, my exports do not work, and my Swing GUI is not firing up
because the apple.laf-packages are not visible to it.

So I got basically these questions:

- Is using the fragment bundle still the preferred approach to this problem?
- If so, what did I do wrong?
- If not, what is the preferred approach to run a Swing application
within Equinox (and it would be nice if it worked in other OSGi
containers as well)?

Thank you.

Best regards,
Jan Thomä
Re: Cannot attach a fragment to the system bundle. [message #130043 is a reply to message #130030] Wed, 29 April 2009 13:03 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Hi Jan,
A system fragment is still the best way to do this sort of thing.

Here's the system fragment we use in the servletbridge:
--
Manifest-Version: 1.0

Export-Package: org.eclipse.equinox.servletbridge; version=1.0, javax.

servlet; version=2.5, javax.servlet.http; version=2.5, javax.servlet.

resources; version=2.5

Fragment-Host: system.bundle; extension:=framework

Bundle-Version: 1.0.0

Bundle-Name: Servletbridge Extension Bundle

Bundle-ManifestVersion: 2

Bundle-SymbolicName: org.eclipse.equinox.servletbridge.extensionbundle

--

I see a few differences but you might also see if "diag" returns anything
helpful.

HTH
-Simon

"Jan Thom
Re: Cannot attach a fragment to the system bundle. [message #130067 is a reply to message #130030] Wed, 29 April 2009 18:07 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Jan Thomä schrieb:
> Now when i start that bundle up in Equinox, it goes into installed
> state, but is not attached to the system.bundle:

Hmm, I might be wrong but I remember that some bundles that are required
to be loaded with (or by) the system bundle during startup need to be
located right next to the system bundle, i.e. in the same folder. At
least with framework extension bundles that should be the case. Can you
give this a try?

-Gunnar

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Re: Cannot attach a fragment to the system bundle. [message #130080 is a reply to message #130043] Wed, 29 April 2009 18:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

Hi Simon,

this is very odd. I double checked my headers, but the bundle is still
not attached as a fragment to the system bundle.

osgi> bundle 20
initial@file://Users/kork/devel/java/peroxIDE-J/classes/prod uction/peroxIDE-system.jar
[20]
Id=20, Status=INSTALLED Data
Root=/Users/kork/Library/Caches/IntelliJIDEA8x/osmorc/runtmp 1241028657451/fwDir/org.eclipse.osgi/bundles/20/data


No registered services.
No services in use.
Exported packages
apple.laf; version="0.0.0"[exported]
No imported packages
No host bundles
No named class spaces
No required bundles

osgi> headers 20
Bundle headers:
Bundle-ManifestVersion = 2
Bundle-Name = Extension Bundle
Bundle-SymbolicName = de.insomniahq.peroxidej.system
Bundle-Version = 1.0.0
Created-By = IntelliJ IDEA
Export-Package = apple.laf
Fragment-Host = system.bundle; extension:=framework
Manifest-Version = 1.0


osgi> diag 20
initial@file://Users/kork/devel/java/peroxIDE-J/classes/prod uction/peroxIDE-system.jar
[20]
No unresolved constraints.

Diag is showing no issues either. I tried with equinox 3.4 and 3.5M1
both showing the same behaviour. Does the bundle need to contain some
additional files except the Manifest.MF ? Does it need to be in some
special location so it can attach to the system.bundle?

Best regards,
Jan
Re: Cannot attach a fragment to the system bundle. [message #130132 is a reply to message #130067] Wed, 29 April 2009 19:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

On 2009-04-29 20:07:21 +0200, Gunnar Wagenknecht <gunnar@wagenknecht.org> said:

> Jan Thomä schrieb:
>> Now when i start that bundle up in Equinox, it goes into installed
>> state, but is not attached to the system.bundle:
>
> Hmm, I might be wrong but I remember that some bundles that are required
> to be loaded with (or by) the system bundle during startup need to be
> located right next to the system bundle, i.e. in the same folder. At
> least with framework extension bundles that should be the case. Can you
> give this a try?

Thanks for the pointer. I moved the package over to
<EQUINOX_HOME>/plugins, right next to the system bundle. No change of
behaviour. Then I tried starting it up using the
osgi.framework.extensions property instead of adding it to
osgi.bundles. No change either. So putting it next to the system bundle
does not seem to have any effect. Anything else i could try?

Jan
Re: Cannot attach a fragment to the system bundle. [message #130157 is a reply to message #130132] Wed, 29 April 2009 20:11 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Attach your jar and I'll try it out when I get a moment.

"Jan Thom
Re: Cannot attach a fragment to the system bundle. [message #130169 is a reply to message #130157] Wed, 29 April 2009 20:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

On 2009-04-29 22:11:02 +0200, "Simon Kaegi" <simon_kaegi@ca.ibm.com> said:

> Attach your jar and I'll try it out when I get a moment.


Simon, thanks a lot for trying this. I have uploaded the file to
http://kork.insomnia-hq.de/public/de.insomniahq.peroxidej.sy stem_1.0.0v0.jar.

Jan
Re: Cannot attach a fragment to the system bundle. [message #130181 is a reply to message #130169] Wed, 29 April 2009 20:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

On 2009-04-29 22:29:29 +0200, Jan Thomä <janthomae@janthomae.de> said:

> On 2009-04-29 22:11:02 +0200, "Simon Kaegi" <simon_kaegi@ca.ibm.com> said:
>
>> Attach your jar and I'll try it out when I get a moment.
>
>
> Simon, thanks a lot for trying this. I have uploaded the file to
> http://kork.insomnia-hq.de/public/de.insomniahq.peroxidej.sy stem_1.0.0v0.jar.

Jan

Which
>
reminds me to never put a dot behind an url. Here is the working link:

http://kork.insomnia-hq.de/public/de.insomniahq.peroxidej.sy stem_1.0.0v0.jar


Thanks again,
Jan
Re: Cannot attach a fragment to the system bundle. [message #130283 is a reply to message #130181] Thu, 30 April 2009 19:21 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Your bundle works for me.
I started the framework installed your bundle and then "refresh"ed and then
saw everything attached correctly.
-Simon


"Jan Thom
Re: Cannot attach a fragment to the system bundle. [message #130519 is a reply to message #130283] Sun, 03 May 2009 08:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

On 2009-04-30 21:21:44 +0200, "Simon Kaegi" <simon_kaegi@ca.ibm.com> said:

> Your bundle works for me.
> I started the framework installed your bundle and then "refresh"ed and then
> saw everything attached correctly.
> -Simon
>


Thanks for trying it out. For some odd reason I expected it to be
working on your end. What Equinox version are you using?

Jan
Re: Cannot attach a fragment to the system bundle. [message #130532 is a reply to message #130519] Sun, 03 May 2009 17:31 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
3.5m7
I also tried with 3.4.2 without a problem

--
1) I launched with -console
2) At the console I typed install
file:///c:/35work/de.insomniahq.peroxidej.system_1.0.0v0.jar
3) I type "ss" and see the new bundle is INSTALLED
4) I type refresh and I see the bundle is now RESOLVED and attached to
bundle 0

One thing I wonder is if you're caching bad headers. You might try from a
fresh install

HTH
-Simon

"Jand Thom
Re: Cannot attach a fragment to the system bundle. [message #130678 is a reply to message #130532] Tue, 05 May 2009 08:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

Thank you Simon!

Now that is really funny. When I try it standalone without any other
bundles involved, it works like a charm, no issues. When I install
other bundles before by using the -Dosgi.bundles switch, it doesn't
work. So i tried migrating your way of starting it slowly to my way of
starting it, to see where it breaks.

-------[ First Approach ] --------------------

Start up using: java -jar org.eclipse.osgi_3.5.0.v20080804-1730.jar -console

osgi> install
file:///Users/kork/devel/java/osgiframeworks/equinox-3.5M1/p lugins/de.insomniahq.peroxidej.system_1.0.0v0.jar
Bundle

id is 32
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20080804-1730
32 INSTALLED de.insomniahq.peroxidej.system_1.0.0

osgi> refresh
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20080804-1730
Fragments=32
32 RESOLVED de.insomniahq.peroxidej.system_1.0.0
Master=0

So this works.

------[ Second Approach ] -----------------------

Start up using:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Hom e/bin/java
-Declipse.ignoreApp=true -Dosgi.framework.beginningstartlevel=15
-classpath
/Users/kork/devel/java/osgiframeworks/equinox-3.5M1/plugins/ org.eclipse.osgi_3.5.0.v20080804-1730.jar
org.eclipse.core.runtime.adaptor.EclipseStarter -console -debug

osgi> Time to load bundles: 1
osgi> install
file:///Users/kork/devel/java/osgiframeworks/equinox-3.5M1/p lugins/de.insomniahq.peroxidej.system_1.0.0v0.jar
Bundle

id is 1

osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20080804-1730
1 INSTALLED de.insomniahq.peroxidej.system_1.0.0

osgi> refresh
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20080804-1730
Fragments=1
1 RESOLVED de.insomniahq.peroxidej.system_1.0.0
Master=0


Works as well.

------[ Third Approach ] -----------------------

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Hom e/bin/java
-Dosgi.bundles= file:///Users/kork/devel/java/osgiframeworks/equinox-3.5M1/p lugins/de.insomniahq.peroxidej.system_1.0.0v0.jar
-Declipse.ignoreApp=true -Dosgi.framework.beginningstartlevel=15
-classpath
/Users/kork/devel/java/osgiframeworks/equinox-3.5M1/plugins/ org.eclipse.osgi_3.5.0.v20080804-1730.jar
org.eclipse.core.runtime.adaptor.EclipseStarter -console -debug
Debug options:

file:/Users/kork/devel/java/osgiframeworks/equinox-3.5M1/plu gins/.options
not found

osgi> Time to load bundles: 44
ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20080804-1730
Fragments=1
1 RESOLVED de.insomniahq.peroxidej.system_1.0.0
Master=0

Voila, works even without typing something on the console. So the issue
must come up when I start more than one bundle.

I assume that the issue comes up in conjunction with one of the other
bundles I am starting. So I will try around and add one more bundle and
one more until it breaks. I just hope it isn't the Spring stuff...

Thanks for all your help so far, I'll post my results once I finish the
analysis.

Jan
Re: Cannot attach a fragment to the system bundle. [message #131080 is a reply to message #130030] Mon, 11 May 2009 15:54 Go to previous message
Eclipse UserFriend
Originally posted by: janthomae.janthomae.de

Hi again,

and thanks for all the help so far.

I found out what is actually causing the issue. The issue occurs, when
I install two different versions of the slf4j-api bundle at the same
time:

com.springsource.slf4j.api-1.5.6.jar - from the SpringSource maven repo
slf4j-api-1.5.0.jar - from the public maven repo

Additionally you need to install these, so the bundles actually resolve:

com.springsource.org.apache.log4j-1.2.15.jar - from the SpringSource maven repo
com.springsource.slf4j.log4j-1.5.6.jar - from the SpringSource maven repo

If the bundles do not resolve, then attaching my bundle (which can be
downloaded at
http://kork.insomnia-hq.de/public/de.insomniahq.peroxidej.sy stem_1.0.0v0.jar)
to the system bundle works. Once both slf4j-api bundles are installed
and resolved, my fragment will no longer attach to the system bundle.
Not on refresh, not on restart, never. I am not an OSGi guru, but that
doesn't sound like correct behaviour to me. Attaching to the system
bundle should work no matter what other bundles are installed. Could
someone please confirm this? I would file a bug report against equinox
then.

Best regards,
Jan
Previous Topic:Unsatisfied dependency, recursive??
Next Topic:mixing native and custom actions in p2.inf
Goto Forum:
  


Current Time: Thu Apr 25 08:11:27 GMT 2024

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

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

Back to the top