Equinox Extension loading buggy? [message #98617] |
Fri, 28 September 2007 11:15  |
Eclipse User |
|
|
|
Originally posted by: Jan-Hendrik.Diederich.bredex.de
Hello,
the access of a file from an OSGi Extension Bundle at startup time failed.
I have the question: does it work at all?
To make it clearer I explain the steps I've done in detail:
- Put the file which should be loaded later in a jar-file. In the root
directory of the jar.
- Add a valid manifest, with a comma-seperated Bundle-ClassPath, pointing
to the bundle itself (package.xyz.jar), and the jar itself (.).
- Add the jar file as an Eclipse Equinox extension.
- Put the jar file in the eclipse/plugin directory (no extension plugin
directory!).
- Edit my Eclipse config.ini and add the line:
" osgi.framework.extensions=org.eclipse.equinox.myplugin,org.e clipse.equinox.myplugin.two "
- Then I start Eclipse, and try to load the file at startup time. Via
"getClass().getClassLoader.getResources("myfile");". The Classloader is
the Classloader from the eclipse class
"org.eclipse.equinox.launcher.Main". It's the "Main$StartupClassLoader".
- I only get the files from the original Eclipse jar. Not my own jar!
If I understood it right, this is a bug, because the jar/Bundle should
have been within the classpath of the StartupClassLoader. Because it's an
OSGi Extension. And therefore my file should've been loaded.
So, should I open a bug-report?
Irritated,
Jan Diederich
|
|
|
Re: Equinox Extension loading buggy? [message #98669 is a reply to message #98617] |
Fri, 28 September 2007 13:46   |
Eclipse User |
|
|
|
Jan,
Extension bundles definitely work. It's a guess, but did you add...
Fragment-Host: system.bundle; extension:=framework
to your bundle's manifest?
If that's not it can you post your manifest and the result of an "ss" in the
console.
HTH
-Simon
"Jan Diederich" <Jan-Hendrik.Diederich@bredex.de> wrote in message
news:0b1faadad2defae24bd72a589595e362$1@www.eclipse.org...
> Hello,
> the access of a file from an OSGi Extension Bundle at startup time failed.
> I have the question: does it work at all?
> To make it clearer I explain the steps I've done in detail:
> - Put the file which should be loaded later in a jar-file. In the root
> directory of the jar.
> - Add a valid manifest, with a comma-seperated Bundle-ClassPath, pointing
> to the bundle itself (package.xyz.jar), and the jar itself (.).
> - Add the jar file as an Eclipse Equinox extension. - Put the jar file in
> the eclipse/plugin directory (no extension plugin directory!).
> - Edit my Eclipse config.ini and add the line:
> " osgi.framework.extensions=org.eclipse.equinox.myplugin,org.e clipse.equinox.myplugin.two "
> - Then I start Eclipse, and try to load the file at startup time. Via
> "getClass().getClassLoader.getResources("myfile");". The Classloader is
> the Classloader from the eclipse class
> "org.eclipse.equinox.launcher.Main". It's the "Main$StartupClassLoader".
> - I only get the files from the original Eclipse jar. Not my own jar!
>
> If I understood it right, this is a bug, because the jar/Bundle should
> have been within the classpath of the StartupClassLoader. Because it's an
> OSGi Extension. And therefore my file should've been loaded.
>
> So, should I open a bug-report?
>
> Irritated,
> Jan Diederich
>
|
|
|
|
Re: Equinox Extension loading buggy? [message #99070 is a reply to message #98728] |
Mon, 01 October 2007 07:33   |
Eclipse User |
|
|
|
Originally posted by: Jan-Hendrik.Diederich.bredex.de
Jan Diederich wrote:
This also doesn't work. The problem is not that it's not loaded at all.
That was never the problem. It's only that equinox can't find any files in
the bundle.
In the original equinox source-code the files are tried to load with
getClass().getResources(), and the overladed .getResources() doesn't look
into my jar. Even if it's defined as "Fragment-Host".
Here is the line of code:
hookConfigurators = cl != null ?
cl.getResources(HookRegistry.HOOK_CONFIGURATORS_FILE) :
ClassLoader.getSystemResources(HookRegistry.HOOK_CONFIGURATO RS_FILE);
My jar has the "HookRegistry.HOOK_CONFIGURATORS_FILE" in its root dir, but
that's ignored completly.
Here is the output from the console:
osgi> ss
getService[System Bundle
[0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.id=34})
getService[System Bundle
[0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.id=28})
getService[System Bundle
[0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.ranking=2147483647,
service.id=21})
getService[System Bundle
[0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.ranking=2147483647,
service.pid=0.org.eclipse.core.runtime.internal.adaptor.Ecli pseCommandProvider,
service.vendor=Eclipse.org, service.id=17})
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
Fragments=502
...
// My Plugin:
502 RESOLVED org.eclipse.equinox.transforms_1.0.0
Master=0
Very grateful if you have any idea,
Jan Diederich
> Thanks,
> I really didn't know that you have to add "extension:=framework" to the
> bundles manifest. I will test this.
> Thanks,
> Jan Diederich
> Simon Kaegi wrote:
>> Jan,
>> Extension bundles definitely work. It's a guess, but did you add...
>> Fragment-Host: system.bundle; extension:=framework
>> to your bundle's manifest?
>> If that's not it can you post your manifest and the result of an "ss" in
the
>> console.
>> HTH
>> -Simon
|
|
|
Re: Equinox Extension loading buggy? [message #99085 is a reply to message #99070] |
Mon, 01 October 2007 09:45  |
Eclipse User |
|
|
|
Hmm... perhaps try taking you hook configurator file out of the jar and
simply placing the raw file at the root of the bundle.
If I'm understanding the structure of your extension bundle correctly it
sounds like you have a JAR inside of your bundle JAR which might be
problematic.
The framework's class loader is a slightly augmented URLClassLoader and I
suspect you'll run into problems when using a URLConnection to read a
jar:jar: resource simply because this isn't supported.
Another idea is to place a few break points in relevant pieces of
URLClassLoader to directly see what happening.
HTH
-Simon
"Jan Diederich" <Jan-Hendrik.Diederich@bredex.de> wrote in message
news:99af6142c81a6ab72077d58bc09877bb$1@www.eclipse.org...
> Jan Diederich wrote:
> This also doesn't work. The problem is not that it's not loaded at all.
> That was never the problem. It's only that equinox can't find any files in
> the bundle.
> In the original equinox source-code the files are tried to load with
> getClass().getResources(), and the overladed .getResources() doesn't look
> into my jar. Even if it's defined as "Fragment-Host".
> Here is the line of code:
> hookConfigurators = cl != null ?
> cl.getResources(HookRegistry.HOOK_CONFIGURATORS_FILE) :
> ClassLoader.getSystemResources(HookRegistry.HOOK_CONFIGURATO RS_FILE);
>
> My jar has the "HookRegistry.HOOK_CONFIGURATORS_FILE" in its root dir, but
> that's ignored completly.
>
>
> Here is the output from the console:
> osgi> ss
> getService[System Bundle
> [0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.id=34})
> getService[System Bundle
> [0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.id=28})
> getService[System Bundle
> [0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.ranking=2147483647,
> service.id=21})
> getService[System Bundle
> [0]]({org.eclipse.osgi.framework.console.CommandProvider}={s ervice.ranking=2147483647,
> service.pid=0.org.eclipse.core.runtime.internal.adaptor.Ecli pseCommandProvider,
> service.vendor=Eclipse.org, service.id=17})
>
> Framework is launched.
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
> Fragments=502
> ..
> // My Plugin:
> 502 RESOLVED org.eclipse.equinox.transforms_1.0.0
> Master=0
>
> Very grateful if you have any idea,
> Jan Diederich
>
>
>> Thanks,
>> I really didn't know that you have to add "extension:=framework" to the
>> bundles manifest. I will test this.
>
>> Thanks,
>> Jan Diederich
>
>> Simon Kaegi wrote:
>>> Jan,
>
>>> Extension bundles definitely work. It's a guess, but did you add...
>>> Fragment-Host: system.bundle; extension:=framework
>>> to your bundle's manifest?
>
>>> If that's not it can you post your manifest and the result of an "ss" in
> the
>>> console.
>
>>> HTH
>>> -Simon
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04685 seconds