[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] Issues deploying aspects
|
try replacing
> pointcut notNextMethod() : executingMethod() &&
!cflow(executingMethod());
with
pointcut notNextMethod() : executingMethod() &&
!cflowbelow(executingMethod());
The difference between cflow and cflowbelow is that cflow also includes
the joinpoints matched by its pointcut expression, whereas cflowbelow does
not. In other words, if you write !cflow(executingMethod()) you are also
excluding any join point matched by executingMethod(), which is not what
you want here.
-- Adrian
Adrian_Colyer@xxxxxxxxxx
James Cook <James.Cook@xxxxxxxxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx
25/05/2004 13:06
Please respond to
aspectj-users
To
"'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
cc
Subject
RE: [aspectj-users] Issues deploying aspects
Thanks for that. I upgraded to 1.2 and used:
pointcut executingMethod() : execution(public * SessionBean+.*(..));
It deploys just fine now.
Just one more question. Can I prevent subsequent methods called from the
initial pointcut from being captured as well?
For example, if I have:
public void methodA() {
methodB();
}
public void methodB() {
}
when methodA and methodB are called independantly, I want them to match
the pointcut, but I dont want methodB to be caught when it is called from
methodA. I thought that:
pointcut executingMethod() : execution(public * SessionBean+.*(..));
pointcut notNextMethod() : executingMethod() && !cflow(executingMethod());
would work, but that prevents all methods from being matched!
Cheers
James
-----Original Message-----
From: Ron Bodkin [mailto:rbodkin@xxxxxxxxxxxxxx]
Sent: 24 May 2004 18:51
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Issues deploying aspects
Hi James,
I have a couple of comments below. First off, though, I don't think you
want to use a call pointcut for capturing EJB methods because the call to
the session bean will be made by the container (and probably
reflectively). I would suggest using an execution pointcut because you do
control the code for executing the session beans (i.e., it's easy to weave
into that).
You could use this version:
pointcut executingMethod() : this(SessionBean) && execution(public *
*(..));
Now to your questions:
>1) When I have specified SessionBean, why does aspectj touch
JobTranslationBean which is an >EntityBean?
AspectJ 1.1.1 did not include an optimization to restrict weaves into
calls based on the dynamic type of the target. However, AspectJ 1.2rc2
does have an optimization that restricts where join points get woven in
this way. If you didn't want to use AspectJ 1.1.1 you probably would want
to use this alternative:
pointcut executingMethod() : execution(public * SessionBean+.*(..));
It probably means the same thing for your code (unless you have methods in
a base class of your session beans that you also want to secure...)
>2) Since it has touched my EntityBean, why has it put an additional field
on it?
This field holds information about the call join point because you access
thisJoinPoint in your advice.
3) JobTranslationBean is in a seperate package, I only want my aspect to
effect the classes in the package it itself is in. How can I do that?
pointcut executingMethod() :
this(SessionBean) && execution(public * *(..)) &&
within(com.example.mypackage..*);
------------Original Message------------
From: James Cook <James.Cook@xxxxxxxxxxxxxxx>
To: "'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
Date: Mon, May-24-2004 9:21 AM
Subject: [aspectj-users] Issues deploying aspects
Excuse my newbie questions, but I am having some problems getting aspects
to work correctly.
When I try the following aspect on my code:
import javax.ejb.*;
public aspect Security {
pointcut callingMethod() : target(SessionBean) && call(public *
*(..));
before(): callingMethod() {
System.out.println("Entering " + thisJoinPoint);
Object[] tmp = thisJoinPoint.getArgs();
for (int i = 0; i < tmp.length; i++) {
SecurityChecker.check(tmp[i], SecurityChecker.TEXT);
}
}
}
I get the following error when deploying:
Unable to deploy EJB: erm-ejb.jar from erm-ejb.jar:
In EJB JobTranslationBean, the primary key field named ajc$tjp_0 is not a
CMP managed field.
at
weblogic.ejb20.compliance.EJBComplianceChecker.check(EJBComplianceChecker.java:268)
at
weblogic.ejb20.compliance.EJBComplianceChecker.checkDeploymentInfo(EJBComplianceChecker.java:232)
at
weblogic.ejb20.ejbc.EJBCompiler.complianceCheckJar(EJBCompiler.java:810)
at
weblogic.ejb20.ejbc.EJBCompiler.checkCompliance(EJBCompiler.java:766)
...etc
Now this presents several questions:
Thanks in advance
James
Setup:
Java 1.4.2
aspectj-1.1.1
Weblogic 8.1
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users