Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
SV: [aspectj-users] Weid problem with javax.naming.InitialContext

Hi

It does and does not with my testcase. I'll elaborate on it here.

What I am trying to do is to manage the Namingservices, JDBC, Logging etc.
og a J2EE clustered environment. The way I do that is to introduce managed
beans into the various classes that implement those. This is working fine
for all except for the InitialContext which is part of rt.jar. Now the way
InitialContext works is that it really is a proxy for a specific
implementation given to it by a factory that is configured through an
evnvironment setting. When I step through it in debug mode, I see that in
the after construction of the InitialContext (yes it does apply that
poincut) it does not have the introduced member. However, the implementation
class that it is a proxy for does have - go figure!

Hermod

-----Opprinnelig melding-----
Fra: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] På vegne av Andy Clement
Sendt: 24. januar 2008 17:37
Til: aspectj-users@xxxxxxxxxxx
Emne: Re: [aspectj-users] Weid problem with javax.naming.InitialContext

I have only tested it with weaving my own javax types - I am not an expert
on LTW so I don't know how you set it up such that a weaver instance is
associated with the rt.jar.  Hopefully someone else can comment on this.

With the flag on, declare parents will weave fine into javax types (just
tried it).

Andy.

On 24/01/2008, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx> wrote:
> Hi
>
> I tried this, but it is still not weaving javax packages that are in 
> the rt.jar (java runtime) - It does (and has all the time) weave javax 
> packages that are external to rt.jar.
>
> I tried this on: AspectJ Weaver Version DEVELOPMENT built on Wednesday 
> Jan 23, 2008 at 01:03:57 GMT
>
> By the way: I am running this on IBM JDK 1.3 using the 
> aspectJ14adapter and the java14adapter created using the Aspectwerkz
createjavaadapter.
> This should not come into play because that only makes sure that 
> weaving can take place on a JDK13/JDK14 in the first place. Everything 
> else works just as it should.
>
> Hermod
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx 
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: Wednesday, January 23, 2008 6:18 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Weid problem with 
> javax.naming.InitialContext
>
>
> I think you are possibly being affected by the code we have that 
> prevents LTW of anything beginning java.* or javax.* :)  See this 
> bugzilla entry from a while back
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=149261 : "Allow weaving
> javax..* types"
>
> In which case, you need to download a recent dev build of AspectJ from 
> the downloads page and use the option:
>
> <weaver options="-Xset:weaveJavaxPackages=true"/>
>
> Andy.
>
> On 23/01/2008, hermod.opstvedt@xxxxxxxxx <hermod.opstvedt@xxxxxxxxx>
> wrote:
> >
> >
> >
> > Hi
> >
> > This really has me stomped. I am absolutely unable to loadtime weave 
> > the InitialContext class. The exact syntax is applied to 2 different 
> > classes - one works and the other does not. I do not see anyt 
> > weaving output that states that it is weaving anything within the 
> > javax.naming
>
> > package
> >
> > Hermod
> >
> > Below is the verification test
> >
> > aop.xml:
> > <aspectj>
> >         <weaver
> >                 options="-proceedOnError 
> > -Xlintfile:META-INF/Xlint.properties -showWeaveInfo -verbose -debug">
> >                 <include within="com.ibm.websphere.naming..*" />
> >                 <include
> > within="com.ibm.ws.naming.util.WsnInitCtx+" />
> >                 <include within="javax.naming..*" />
> >                 <include within="com.acme.test..*" />
> >         <aspects>
> >                 <aspect
> > name="com.acme.aspect.NamingServiceAspect" />
> >         </aspects>
> > </aspectj>
> >
> > package com.acme.aspect;
> > public aspect NamingServiceAspect {
> >
> >         pointcut initialContextInit() : call(* 
> > javax.naming.InitialContext+.init(..));
> >
> >         void around() : initialContextInit()
> >         {
> >                 System.out.println("In around initialContextInit");
> >                 proceed();
> >         }
> >
> >         pointcut testDoit() : call(* 
> > no.dnbnor.it01.aspects.test.Test+.doIt(..));
> >
> >         void around() : testDoit()
> >         {
> >                 System.out.println("In around testDoit");
> >                 proceed();
> >         }
> > }
> >
> > And a test class:
> >
> > package com.acme.test;
> > public class Test {
> >
> >         public static void main(String[] args) throws Exception {
> >                 Hashtable env = new Hashtable();
> >                 env.put(Context.INITIAL_CONTEXT_FACTORY,
> >
> > "com.ibm.websphere.naming.WsnInitialContextFactory");
> >                 env
> >                                 .put(Context.PROVIDER_URL,
> >
> "iiop://localhost:2809");
> >                 Context initialContext = new InitialContext(env);
> >                 Test me=new Test();
> >                 me.doIt();
> >                 }
> >
> >         public void doIt()
> >         {
> >             System.out.println("In doIt");
> >         }
> > } * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> > *
> > * * *
> > *
> >
> > This email with attachments is solely for the use of the individual 
> > or
>
> > entity to whom it is addressed. Please also be aware that the DnB 
> > NOR Group cannot accept any payment orders or other legally binding 
> > correspondence with customers as a part of an email.
> >
> > This email message has been virus checked by the anti virus programs 
> > used in the DnB NOR Group.
> >
> > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> > *
> > * * *
> >
> >
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> * * *
>
> This email with attachments is solely for the use of the individual or 
> entity to whom it is addressed. Please also be aware that the DnB NOR 
> Group cannot accept any payment orders or other legally binding 
> correspondence with customers as a part of an email.
>
> This email message has been virus checked by the anti virus programs 
> used in the DnB NOR Group.
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> * * *
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top