You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Łukasz Dywicki <lu...@code-house.org> on 2010/11/21 21:59:01 UTC

Equinox packages

Hi All,
I would test Equinox + AspectJ integration with Karaf but I stuck. I have
following bundles installed:

START LEVEL 100 , List Threshold: 50
   ID   State         Blueprint      Level  Name
[  37] [Installed  ] [            ] [   60] WeavingService Plug-in
(Incubation) (1.0.0.200905031323)
[  38] [Installed  ] [            ] [   60] Aspect Weaving Hooks Plug-in
(Incubation) (1.0.0.200905031323)
[  39] [Installed  ] [            ] [   60] J9 CachingService Plug-in
(Incubation) (1.0.0.200905031323)
[  40] [Installed  ] [            ] [   60] Standard Caching Service for
Equinox Aspects (Incubation) (1.0.0.200905031323)

These bundles are required to enable AspectJ runtime weaving. When I try to
start bundle 38 I've following error:
Error executing command: Fragment bundles cannot be started.

Ok, but who is host of this bundle? Host is org.eclipse.osgi. Do you have
any ideas how to resolve these two bundles - org.eclipse.osgi and AspectJ
Weaving hook plugin?

Best regards,
Lukasz



RE: Equinox packages

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hi again :)
Guillaume notified me about KARAF-239 resolved in 2.1 [1] release. I think
that it's workaround not the right solution. Installing Equinox extensions
in lib/ is kinda of hardcoding. There will be no way to enable aspects
through Karaf features.


Regards,
Lukasz
[1] https://issues.apache.org/jira/browse/KARAF-239

-----Original Message-----
From: Łukasz Dywicki [mailto:luke@code-house.org] 
Sent: Tuesday, November 23, 2010 3:34 PM
To: dev@karaf.apache.org
Subject: RE: Equinox packages

Hi,
I installed these bundles to Karaf. I found issue with equinox fragments.
Framework resolves them correctly but Equinox use URLClassLoader from
org.apache.karaf.main.Main. This is main reason why fragments are not
"visible" for Equinox. I think that it's may be a bug or Equinox issue.

Guilty is following line second line
(org.eclipse.osgi.baseadaptor.HookRegistry.mergeFileHookConfigurators lines
from 107 to 115):
--
ClassLoader cl = getClass().getClassLoader();
// get all hook configurators files in your classloader delegation
Enumeration hookConfigurators;
try {
	hookConfigurators = cl != null ?
cl.getResources(HookRegistry.HOOK_CONFIGURATORS_FILE) :
ClassLoader.getSystemResources(HookRegistry.HOOK_CONFIGURATORS_FILE);
} catch (IOException e) {
	errors.add(new
FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME,
FrameworkLogEntry.ERROR, 0, "getResources error on " +
HookRegistry.HOOK_CONFIGURATORS_FILE, 0, e, null)); //$NON-NLS-1$
	return;
}
--

The 'cl' variable points to URLClassLoader as long as it will not be a OSGi
managed class loaders Equinox hooks / fragments won't work correctly. I
don't have idea how fix that.

Best regards,
Lukasz

-----Original Message-----
From: Charles Moulliard [mailto:cmoulliard@gmail.com] 
Sent: Monday, November 22, 2010 9:06 AM
To: dev@karaf.apache.org
Subject: Re: Equinox packages

Hi Lukasz,

According to Equinox documentation 
(http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-star
t.php), 
the following bundles are required :

# /org.eclipse.osgi/ (The system bundle)
# /org.eclipse.equinox.weaving.hook/ (Must be co-located with the system 
bundle!)
# /org.eclipse.equinox.weaving.aspectj/
# /org.aspectj.runtime/
# /org.aspectj.weaver/

The other are optional

I don't know what they would like to say but it seems that the system 
fragment /org.eclipse.equinox.weaving.hook /must be placed after the 
system bundle ! Try to change the bundle start level of this bundle to 
have a lowest value as this is the case with the system bundle.

Regards,

Charles
On 21/11/10 21:59, Łukasz Dywicki wrote:
> Aspect Weaving Hooks Plug-in



RE: Equinox packages

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hi,
I installed these bundles to Karaf. I found issue with equinox fragments.
Framework resolves them correctly but Equinox use URLClassLoader from
org.apache.karaf.main.Main. This is main reason why fragments are not
"visible" for Equinox. I think that it's may be a bug or Equinox issue.

Guilty is following line second line
(org.eclipse.osgi.baseadaptor.HookRegistry.mergeFileHookConfigurators lines
from 107 to 115):
--
ClassLoader cl = getClass().getClassLoader();
// get all hook configurators files in your classloader delegation
Enumeration hookConfigurators;
try {
	hookConfigurators = cl != null ?
cl.getResources(HookRegistry.HOOK_CONFIGURATORS_FILE) :
ClassLoader.getSystemResources(HookRegistry.HOOK_CONFIGURATORS_FILE);
} catch (IOException e) {
	errors.add(new
FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME,
FrameworkLogEntry.ERROR, 0, "getResources error on " +
HookRegistry.HOOK_CONFIGURATORS_FILE, 0, e, null)); //$NON-NLS-1$
	return;
}
--

The 'cl' variable points to URLClassLoader as long as it will not be a OSGi
managed class loaders Equinox hooks / fragments won't work correctly. I
don't have idea how fix that.

Best regards,
Lukasz

-----Original Message-----
From: Charles Moulliard [mailto:cmoulliard@gmail.com] 
Sent: Monday, November 22, 2010 9:06 AM
To: dev@karaf.apache.org
Subject: Re: Equinox packages

Hi Lukasz,

According to Equinox documentation 
(http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-star
t.php), 
the following bundles are required :

# /org.eclipse.osgi/ (The system bundle)
# /org.eclipse.equinox.weaving.hook/ (Must be co-located with the system 
bundle!)
# /org.eclipse.equinox.weaving.aspectj/
# /org.aspectj.runtime/
# /org.aspectj.weaver/

The other are optional

I don't know what they would like to say but it seems that the system 
fragment /org.eclipse.equinox.weaving.hook /must be placed after the 
system bundle ! Try to change the bundle start level of this bundle to 
have a lowest value as this is the case with the system bundle.

Regards,

Charles
On 21/11/10 21:59, Łukasz Dywicki wrote:
> Aspect Weaving Hooks Plug-in


Re: Equinox packages

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Lukasz,

According to Equinox documentation 
(http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-quick-start.php), 
the following bundles are required :

# /org.eclipse.osgi/ (The system bundle)
# /org.eclipse.equinox.weaving.hook/ (Must be co-located with the system 
bundle!)
# /org.eclipse.equinox.weaving.aspectj/
# /org.aspectj.runtime/
# /org.aspectj.weaver/

The other are optional

I don't know what they would like to say but it seems that the system 
fragment /org.eclipse.equinox.weaving.hook /must be placed after the 
system bundle ! Try to change the bundle start level of this bundle to 
have a lowest value as this is the case with the system bundle.

Regards,

Charles
On 21/11/10 21:59, Łukasz Dywicki wrote:
> Aspect Weaving Hooks Plug-in