Skip to main content



      Home
Home » Eclipse Projects » Equinox » Equinox Aspects not functioning as documented
Equinox Aspects not functioning as documented [message #662805] Thu, 31 March 2011 23:13 Go to next message
Eclipse UserFriend
I have created an aspect within one bundle whose pointcut keys off a method call by an interface in another bundle.

I have done all that is described in the documentation in order to properly set up the aspect, but apparently the aspect isn't being engaged. In fact, in the code I am getting a warning saying that the advice "has not been applied".

My aspect is:

public aspect ServiceGate
{
pointcut serviceCatch(Map<String,String> theMap) :
cflowbelow(execution(void BundleActivator.start(BundleContext))) &&
execution(ServiceResult IAresService.performService(Map<String,String>)) &&
args(theMap);

ServiceResult around(Map<String,String> theMap) : serviceCatch(theMap)
{
System.out.println("A Service was called!");

return(proceed(theMap));
}
}

The manifest for the aspect bundle is below:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Security Bridge
Bundle-SymbolicName: mil.af.ares.aspect.security
Bundle-Version: 1.0.0
Bundle-Activator: mil.af.ares.aspect.security.SecurityActivator
Bundle-Vendor: Self
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: mil.af.ares.service.intfc,
org.osgi.framework;version="1.3.0"
Bundle-ActivationPolicy: lazy
Require-Bundle: org.aspectj.runtime;bundle-version="1.6.11";visibility:=reexport
Export-Package: mil.af.ares.aspect.bridge
Eclipse-SupplementBundle: mil.af.ares.service.intfc

and my aop.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
<aspects>
<aspect name="mil.af.ares.aspect.bridge.ServiceGate" />
</aspects>
</aspectj>

This setup follows the documentation for using Equinox Aspects exactly, but for some reason the aspect is not working.

Am I missing something in the setup? I have the weaver working and the hook is properly set up (and the debugger shows the hook code working properly!). I have set up everything else according to the documentation, or at least I am sure that I did. So am I missing something,or have I found a bug in Equinox Aspects. Does it work at all?

If I have found a bug, where do I go to report it? Who do I talk to about problems with this project???

Someone please advise.
Re: Equinox Aspects not functioning as documented [message #662930 is a reply to message #662805] Fri, 01 April 2011 10:02 Go to previous messageGo to next message
Eclipse UserFriend
More information about this problem:

I have placed the aspect and my code into a standalone test aspectJ project, in order to make sure that my pointcut is working properly.

It is. My advice behaves exactly as specified.

Whatever this problem is, it is related to the Equinox Aspects environment. This is a real problem that could well mean that Equinox Aspects is unusable.

Someone please advise, Have I indeed found a bug,and if so, where do I report it? The Equinox Aspects pages do not provide this information.

Re: Equinox Aspects not functioning as documented [message #662941 is a reply to message #662930] Fri, 01 April 2011 10:20 Go to previous messageGo to next message
Eclipse UserFriend
I will leave the question about if this is a bug or not to Martin, but I still suggest you open a bug against the Weaving component at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox with steps to reproduce.

Tom.
Re: Equinox Aspects not functioning as documented [message #663405 is a reply to message #662930] Mon, 04 April 2011 17:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi Robert!

Can you post the first lines of the console output when you are running
your example? Is there something showing up like "weaving service started"?

-Martin


> I have placed the aspect and my code into a standalone test aspectJ
> project, in order to make sure that my pointcut is working properly.
>
> It is. My advice behaves exactly as specified.
>
> Whatever this problem is, it is related to the Equinox Aspects
> environment. This is a real problem that could well mean that Equinox
> Aspects is unusable.
>
> Someone please advise, Have I indeed found a bug,and if so, where do I
> report it? The Equinox Aspects pages do not provide this information.
>
>
Re: Equinox Aspects not functioning as documented [message #665799 is a reply to message #663405] Sat, 16 April 2011 00:24 Go to previous messageGo to next message
Eclipse UserFriend
Sorry it took so long to reply. Family emergency.

Anyway: here are the first lines that appear in my application when it runs:

osgi> [mil.af.ares.aspect.security] info AspectJ Weaver Version DEVELOPMENT built on Monday Apr 4, 2011 at 18:34:06 GMT
[mil.af.ares.aspect.security] info register aspect mil.af.ares.aspect.bridge.ServiceGate
Service Interface started!
Service registered
[mil.af.ares.transport.http] info AspectJ Weaver Version DEVELOPMENT built on Monday Apr 4, 2011 at 18:34:06 GMT
[mil.af.ares.transport.http] info register aspect mil.af.ares.aspect.bridge.ServiceGate
Transport is starting!

The weaver is apparently starting first (I had to play with some start levels to cause this) and appears to be properly registering my aspect. What is bothering me at this point is that the weaver is supposed to find my call to the interface. It seems to be starting but it just isn't actually applying the advice.

Do you have any suggestions on how to make it do this?
Re: Equinox Aspects not functioning as documented [message #666642 is a reply to message #665799] Thu, 21 April 2011 08:16 Go to previous message
Eclipse UserFriend
Hey Robert!

> The weaver is apparently starting first (I had to play with some start
> levels to cause this) and appears to be properly registering my aspect.
> What is bothering me at this point is that the weaver is supposed to
> find my call to the interface. It seems to be starting but it just isn't
> actually applying the advice.

That the weaver bundle is started is good. Are you sure the framework
hook is configured correctly? For example using this option:

-Dosgi.framework.extensions=org.eclipse.equinox.weaving.hook

There should be something appearing like:

"info Adding AspectJ hooks..."

If that doesn't appear, something is broken before the actual weaving
can happen...

-Martin
Previous Topic:how to solve SocketTimeoutException
Next Topic:How do I consume a DS? (Take 2)
Goto Forum:
  


Current Time: Wed Jul 02 19:53:31 EDT 2025

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

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

Back to the top