[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] RE: load weaving EJB
|
Thanks for replying Dean Wampler,
As he said that I have to do load weaving with my EJB container. How can I
do that?
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
aspectj-users-request@xxxxxxxxxxx
Sent: Tuesday, June 03, 2008 7:27 PM
To: aspectj-users@xxxxxxxxxxx
Subject: aspectj-users Digest, Vol 40, Issue 2
Send aspectj-users mailing list submissions to
aspectj-users@xxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
aspectj-users-request@xxxxxxxxxxx
You can reach the person managing the list at
aspectj-users-owner@xxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."
Today's Topics:
1. Re: aspectJ with EJB problem (Dean Wampler)
----------------------------------------------------------------------
Message: 1
Date: Tue, 3 Jun 2008 07:26:19 -0500
From: Dean Wampler <dean@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] aspectJ with EJB problem
To: aspectj-users@xxxxxxxxxxx
Message-ID:
<23391907-C926-41EF-B58F-A82736A84BCF@xxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="windows-1252"
Actually, it would print
Hi Toy My Surname
Hi Toy
If you run this code as a normal Java application (replacing the
InitialContext stuff with "new MyBean()", for example), it works fine.
First, did you compile the code with ajc? If not, are you using load-
time weaving with your EJB container?
I haven't used EJBs in a long time, so I'm not sure how this code is
really implemented and managed by the container. However, I suspect
that you aren't getting an object of type MyBean, but some proxied
object or even a subclass (like they used to do in EJB v2).
Try adding a plus sign, "+" in your pointcut definition:
pointcut insertSurname() : execution(public String MyBean
+.sayHello(..));
This tells AspectJ to match on subclasses too. That might work. If
not, perhaps someone else on the list will have the answer.
Good luck,
Dean
On Jun 3, 2008, at 4:53 AM, Noppanit Charassinvichai wrote:
>
> Dear, All
>
> I was trying to use AspectJ with EJB. My program is very simple, but
> I have a little problem.
>
> This is my Bean which is very simple
>
> @Stateless(mappedName="HelloWorld")
> public class MyBean implements MyBeanFacade
> {
> @Override
> public String sayHello(String name) {
> return "Hi "+name;
> }
>
> }
>
> And this is my aspect
> public aspect TestAOP {
>
> pointcut insertSurname() : execution(public String
> MyBean.sayHello(..));
>
> after() returning(String name) : insertSurname()
> {
> System.out.println(name +" My Surname");
> }
> }
>
>
>
> And this is my client tester
>
> public static void main(String[] args) throws Exception {
> // TODO Auto-generated method stub
> InitialContext context = new InitialContext();
> MyBeanFacade bean =
> (MyBeanFacade)context.lookup("HelloWorld");
> System.out.println(bean.sayHello("Toy"));
> }
>
> And I packed these classes together and deployed to Glassfish, but
> when I invoked the bean. It did show My Surname. It just showed
> Hi Toy on my Console. I think it suppose to show Hi Toy My
> Surname. Something like this. Please help me!!!
> Kindly Regards,
> Noppanit Charassinvichai
> =====================================
> Application Development & Technology
> G-ABLE COMPANY LIMITED
> 127/27,29-31 Panjathani Tower, Nonsee Rd,
> Chongnonsee,Yanawa, Bangkok 10120 Thailand.
> Mobile: 081-962-1412
> Website: www.g-able.com
> E-Mail: noppanit.c@xxxxxxxxxx
> ====================================
>
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com AOP advocacy site
http://aquarium.rubyforge.org AOP for Ruby
http://www.contract4j.org Design by Contract for Java5
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
https://dev.eclipse.org/mailman/private/aspectj-users/attachments/20080603/d
8a51cd1/attachment.html
------------------------------
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
End of aspectj-users Digest, Vol 40, Issue 2
********************************************
No virus found in this incoming message.
Checked by AVG.
Version: 8.0.100 / Virus Database: 269.24.5/1479 - Release Date: 2/6/2551
19:02