Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » AspectJ and RMI problem
AspectJ and RMI problem [message #595114] Mon, 23 October 2006 20:26
Eclipse UserFriend
Originally posted by: giacomoghezzi.fastwebnet.it

Hi, I just started using AspectJ three weeks ago and now I came across a
little problem (I'm guessing it's really really easy but I just can't see
the error I'm making).
I'm starting to use AspectJ to do some logging of RMI applications. In
particular I created the classic Hello World example in RMI. But I quickly
came across a problem when creating my Aspect.
To understand the problem I'll post the RMI server and the aspect I wrote:

here is the Server:

package server;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class ServerEngine extends UnicastRemoteObject implements Compute {

public ServerEngine() throws RemoteException {
super();
}

public String executeTask_1() {
return "Hello!";
}

public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
ServerEngine engine = new ServerEngine();
Naming.rebind("Hello", engine);
System.out.println("ServerEngine bound");
}
catch (Exception e) {
System.err.println("ServerEngine exception: " + e.getMessage());
e.printStackTrace();
}
}

}

And here is the aspect:

package myRMIAspect;
import java.rmi.registry.*;
import java.rmi.Naming;

public aspect MyRMIAspect {

//Tracks the call to rebind
pointcut rebindMethod ():
call (* Naming.rebind(..));

before(Object caller): rebindMethod() && this(caller) {
//Do some actions that I need fo my application
}
}

The problem is that I keep having the same warning for that aspect that
says: advice in [Name of .aj file] has not been applied[Hi, I just started
using AspectJ three weeks ago and now I came across a little problem (I'm
guessing it's really really easy but I just can't see the error I'm
making).
I'm starting to use AspectJ to do some logging of RMI applications. In
particular I created the classic Hello World example in RMI. But I quickly
came across a problem when creating my Aspect.
To understand the problem I'll post the RMI server and the aspect I wrote:

here is the Server:

package server;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class ServerEngine extends UnicastRemoteObject implements Compute {

public ServerEngine() throws RemoteException {
super();
}

public String executeTask_1() {
return "Hello!";
}

public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
ServerEngine engine = new ServerEngine();
Naming.rebind("Hello", engine);
System.out.println("ServerEngine bound");
}
catch (Exception e) {
System.err.println("ServerEngine exception: " + e.getMessage());
e.printStackTrace();
}
}

}

And here is the aspect:

package myRMIAspect;
import java.rmi.registry.*;
import java.rmi.Naming;

public aspect MyRMIAspect {

//Tracks the call to rebind
pointcut rebindMethod ():
call (* Naming.rebind(..));

before(Object caller): rebindMethod() && this(caller) {
//Do some actions that I need fo my application
}
}

The problem is that I keep having the same warning for that before(Object
caller)....etc aspect that says: advice in [Name of .aj file] has not been
applied[Xlint:adviceDidNotMatch]
Obviously the problem is with the use of the this() pointcut designator,
because if I don't use it, there are no warnings. But I really need it
since I have to know the caller of the rmi method "rebind()" for the work
I'm doing.
I really don't know what the problem is, since used almost the same advice
many times in another application that wasn't using RMI (a client-server
application using only sockets)

Can somebody please help me??
Thanks!
Giacomo
Previous Topic:AspectJ and RMI problem
Next Topic:How to retrieve AspectJ model during build in eclipse?
Goto Forum:
  


Current Time: Tue Apr 16 21:05:26 GMT 2024

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

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

Back to the top