[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ajdt-dev] AOP question / wormhole
|
Hello,
this time i got lucky... i got hte user passed down in the object given to the onMessage method of the MessageDrivenBean
But, generally, is it so that i cannot use ThreadLocal with Asyncrhonous messages?
then i suppose even the perfclow aspect would fail for MessageDrivenBean...since it uses ThreadLocal?
sorry for the partially offtopic question
regards
marco
On 5/10/06,
Marco Mistroni <mmistroni@xxxxxxxxx> wrote:
Hello Ron,
how r you ? hope fine..
i have implemented hteh idea described in this threa d (which was to have the currentLogged in user available from both
the WebLayer and the EJB layer) by intercepting a filter and then storing a User (thredlocal)variable
after the dofilter method has been called.
It has always worked fine, but it looks like it is failing whenever my aspectJ pointcuts intercepts a method being called by a
MessagedrivenBean
My assumption is that MDB are executed in a different thread... and i am losing the original User...
do you know how can i avoid that? and generally, how to deal with ThreadLocal in MDB?
thanks in advance and regards
Marco
On 2/18/06, Marco Mistroni
<mmistroni@xxxxxxxxx> wrote:
Hello
Ron,
ok i'll try your latest suggestion on monday and let you know what happened..
i was setting projecst in aspectinpath.. and the problem was that in the cross-reference view i the 'utility project' aspect shows nothing will be intercepted...
If you store the user variable in a
ThreadLocal, you can provide access to that variable from both places and it
should just work. Using a ThreadLocal is typically an alternative to using a
percflow aspect.
will i run into problems in using ThreadLocal in a J2EE environment? my .ear application (where web and ejb resides) are both running in the same VM... but i have read somewhere that using ThreadLocal is kind of dangerous.... i'd appreciate your comment ont his
thanx again for following up this thread.. i'll keep you posted of the results
thanx and regards
marco
Hello Ron,
On 2/17/06, Ron
Bodkin <rbodkin@xxxxxxxxxxxxxx>
wrote:
If you want to weave statically you should convert the Web
and EJB projects to be AspectJ projects and put the utility project as a
classpath entry and on their aspect path. I believe the problem you were seeing
was really a classpath issue: EJB modules don't have Web modules on their
classpath, whereas having a common utility project can fix this.
yes... fact is that the
classes tha ti need to weave should then be also in the utility project, i
guess.
i tried a simple scenario.. define the aspect in an utility project which is
accessible by both projects.
I needed to weave one class in myWeb project, so i setted the
AspectInPath to include myWeb/WebContent/WEB-INF/classes directory, but after
compiling both projects, when i clicked on CrossReference view for my
aspect, it was showing nothing..like it was not attached to any class, although
the class was in the AspectPath..
what i don't want to do is to just move one class in the utility project just
for the sake of weaving it...
Having a common thread local still requires the class to be
accessible to both, though you might be able to get away with weaving
separately.
yes, that is what i did. i actually defined my User class in my myEJB
project, and since the project is referred by myWeb project i was able to
'see' that class in my myWeb aspect.
Only concern that i have now is that, since i m using ThreadLocal too in my
User class, shall i still keep my aspect as percflow?
will it matter if my EJB aspect has default association?
thanx again for still follow up this thread
regards
marco
Hello Ron,
thanx 4 fast reply..
ah... an 'external' utility project..... i havent thought about it...
but then i suspect i will have to set the AspectPath in order for my aspect to
weave classes in a different project....
have tried before.... didnt work out well
as of now i have createda c ommon class that uses threadLocal. i am setting it
up properly in the aspect that intercepts my ServletFilter and accessing it
from my EJB aspect..
thanks for suggestion... i'll try it out and let the list know
thanx again and regards
marco
On
2/17/06, Ron Bodkin < rbodkin@xxxxxxxxxxxxxx>
wrote:
Hi Marco,
It sounds to me like you just need to make the classes
accessible to both projects… If you've set up your projects in RAD making
both the Web and EJB modules have an AspectJ nature, then you can put the
security aspect in a separate utility project that both depend on and that is
included as a utility jar in the ear file, i.e., you need it to be accessible
to both. Does that work for you?
Another approach to make this work inside of RAD is to use
load-time weaving (I have a blog entry describing a plugin for WebSphere that
should work).
Hello Ron,
i have tried ur
suggestions.. it will work fine except for one thing: my
UserRequestAspect and MyAuditAspect are in different]
project in my RAD environment
one is in myEJB project and the other is in myWeb project....
MyAuditAspect should get the user from UserREquestASpect, but since they are in
different projects i have a
ClassNotFoundException at runtime.
myWeb project is already referring to myEJB, and i want to avoid to make myEJb
refer to myWeb for my usecase...
I have posted my problem, the subject is AJDT / RAD / AspectPath again :(
looks to me like i will have to do some tricks, such as creating a class in my
aspect htat i can access via static methods from
my myEJB project aspect... as i have found in this post..
http://groups.google.co.uk/group/CTJUG-Forum/browse_thread/thread/e2a34649eb322d7f/f4c961cf44f90f0c?lnk=st&q=ThreadLocal+AOP&rnum=2&hl=en#f4c961cf44f90f0c
unless.... do you have a better suggestion to give me?
thanks in advance and regards
marco
_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev
_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev
_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev