[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] LTW and AspectOf() NoSuchMethodError
|
Thanks Alex,
Your workaround works well (which means I could have potentially reproduce
it on my own classes by playing with the packages instead of uploading the
bag of dependencies like I did ;)
I will wait for the next dev build to check if it works the usual way.
Yoav
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
> Alexandre Vasseur
> Sent: Tuesday, October 25, 2005 5:47 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] LTW and AspectOf() NoSuchMethodError
>
> Thanks Yoav
> Neil, perhaps the issue you had recently was due to the same
> bug http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg04796.html
>
> It is fixed in the CVS and the fix will be available in the
> next uploaded build.
> As a workaround until there, you have to use the <include /
> <exclude directives in aop.xml so that they don't exclude the
> @Aspect style aspect to be exposed to the weaver, or you have
> to compile the aspect with AJC.
>
> Alex
>
>
> On 10/24/05, Yoav Landman <yoavl@xxxxxxxxxxxx> wrote:
> > I have opened a bug report with a small test case.
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=113587
> >
> > Unfortunately I cannot clean up any 3rd party dependencies,
> since the
> > bug is only reproducible using the jars in question (LTW on my own
> > classes works just fine).
> >
> > Yoav
> >
> > > -----Original Message-----
> > > From: aspectj-users-bounces@xxxxxxxxxxx
> > > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Alexandre
> > > Vasseur
> > > Sent: Monday, October 24, 2005 12:50 PM
> > > To: aspectj-users@xxxxxxxxxxx
> > > Subject: Re: [aspectj-users] LTW and AspectOf() NoSuchMethodError
> > >
> > > yes it looks like a bug. I 'd be happy to have material
> to reproduce
> > > it - perhaps you can extract away the org.apache.
> > > dependancies by weaving one of your own class?
> > >
> > > Note that my comments on aspectOf were only related to
> behavior from
> > > client code. When a join point is shadow is reached, the
> weaver will
> > > always weave a direct call to youraspect.aspectOf - no matter
> > > AJC/LTW/@AspectJ/code style usage.
> > >
> > > This is what happens in your program. Strange thing is that the
> > > aspect does not seems to have this method itself. That's perhaps
> > > something related to the <include directive usage.
> > >
> > > Can you open an issue and attach material?
> > > Thanks
> > > Alex
> > >
> > > On 10/24/05, Yoav Landman <yoavl@xxxxxxxxxxxx> wrote:
> > > > Hi Alex,
> > > >
> > > > As far as I can tell, the call to aspectOf() on the
> > > @AspectJ aspect is
> > > > coming from a client class that is LTW (i.e. there is no
> > > such call in
> > > > the original code). The client class is part of a 3rd party
> > > jar file.
> > > >
> > > > >From what I understand, LTW classes are supposed to be
> using the
> > > > >helper
> > > > class when needing to invoke such an aspect compiled with plain
> > > > 1.5 javac. I thought this call is added automatically
> as part of
> > > > the weaving process, but perhaps I am missing something.
> > > >
> > > > I have successfully been able to use @AspectJ with LTW
> on my own
> > > > client classes, using the same pattern, without adding
> any aspect
> > > > related calls to the client code. It fails, however,
> when trying
> > > > to use the same pattern on the jar class.
> > > >
> > > > Please advise if this looks like a bug and I'll be happy to
> > > open a report.
> > > >
> > > > My client program is:
> > > > public class AopTest {
> > > >
> > > > public static void main(String[] args) throws Exception {
> > > > System.out.println("aspect class: " +
> > > > SessionAspect.class.getName());
> > > > String configFile = "repotest/repository.xml";
> > > > String repHomeDir = "repotest";
> > > >
> > > > Properties env = new Properties();
> > > > env.put(Context.INITIAL_CONTEXT_FACTORY,
> > > >
> > > "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextF
> > > actory");
> > > > env.put(Context.PROVIDER_URL, "localhost");
> > > > InitialContext ctx = new InitialContext(env);
> > > >
> > > > RegistryHelper.registerRepository(ctx, "repo",
> configFile,
> > > > repHomeDir, true); }
> > > >
> > > > The aspect:
> > > > @Aspect
> > > > public class SessionAspect {
> > > > @Around("execution(*
> > > >
> > > org.apache.jackrabbit.core.jndi.RegistryHelper.registerReposit
> > > ory(..))")
> > > > public Object report(ProceedingJoinPoint jp) throws
> Throwable {
> > > > String name = jp.getSignature().getName();
> > > > System.out.println("#### Method = " + name);
> > > > return jp.proceed();
> > > > }
> > > > }
> > > >
> > > > aop.xml:
> > > > <aspectj>
> > > > <weaver options="-XlazyTjp -verbose -showWeaveInfo">
> > > > <include within="test.*"/>
> > > > <include within="org.apache.jackrabbit.core..*"/>
> > > > </weaver>
> > > > <aspects>
> > > > <aspect
> name="net.contentobjects.jcr.aop.SessionAspect"/>
> > > > <aspect name="test.DummyAspect"/>
> > > > </aspects>
> > > > </aspectj>
> > > >
> > > > The output I am getting is:
> > > > aspect class: net.contentobjects.jcr.aop.SessionAspect
> > > > info weaving
> > > >
> > >
> 'org/apache/jackrabbit/core/jndi/provider/DummyInitialContextFactory'
> > > > info weaver operating in reweavable mode. Need to verify
> > > any required
> > > > types exist.
> > > > info weaving
> 'org/apache/jackrabbit/core/jndi/provider/DummyContext'
> > > > info weaver operating in reweavable mode. Need to verify
> > > any required
> > > > types exist.
> > > > info weaving
> > > >
> > >
> 'org/apache/jackrabbit/core/jndi/provider/DummyContext$FlatNameParser'
> > > > info weaver operating in reweavable mode. Need to verify
> > > any required
> > > > types exist.
> > > > info weaving 'org/apache/jackrabbit/core/jndi/RegistryHelper'
> > > > info weaver operating in reweavable mode. Need to verify
> > > any required
> > > > types exist.
> > > > weaveinfo Join point 'method-execution(void
> > > >
> > >
> org.apache.jackrabbit.core.jndi.RegistryHelper.registerRepository(ja
> > > va
> > > > x.nami ng.Context, java.lang.String, java.lang.String,
> > > > java.lang.String, boolean))'
> > > > in Type 'org.apache.jackrabbit.core.jndi.RegistryHelper'
> > > > (RegistryHelper.java:57) advised by around advice from
> > > > 'net.contentobjects.jcr.aop.SessionAspect' (SessionAspect.java)
> > > > Exception in thread "main" java.lang.NoSuchMethodError:
> > > >
> > >
> net.contentobjects.jcr.aop.SessionAspect.aspectOf()Lnet/contentobjec
> > > ts
> > > > /jcr/a
> > > > op/SessionAspect;
> > > > at
> > > >
> > >
> org.apache.jackrabbit.core.jndi.RegistryHelper.registerRepository(Re
> > > gi
> > > > stryHe
> > > > lper.java:1)
> > > > at
> net.contentobjects.jcr.aop.AopTest.main(AopTest.java:37)
> > > > at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > at
> > > >
> > >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> > > .j
> > > > ava:39
> > > > )
> > > > at
> > > >
> > >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> > > ss
> > > > orImpl
> > > > .java:25)
> > > > at java.lang.reflect.Method.invoke(Method.java:585)
> > > > at
> > > >
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:86
> > > > )
> > > >
> > > > > -----Original Message-----
> > > > > From: aspectj-users-bounces@xxxxxxxxxxx
> > > > > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
> > > > > Alexandre Vasseur
> > > > > Sent: Monday, October 24, 2005 11:30 AM
> > > > > To: aspectj-users@xxxxxxxxxxx
> > > > > Subject: Re: [aspectj-users] LTW and AspectOf()
> > > > > NoSuchMethodError
> > > > >
> > > > > Hi
> > > > >
> > > > > Perhaps you could post your aspect and the program (client
> > > > > code) snip that calls aspectOf.
> > > > >
> > > > > For @AspectJ aspect, assuming you have the source code
> > > for it, there
> > > > > is no aspectOf() method. Hence you need to use the
> > > Aspects.aspectOf
> > > > > helper methods in your client code.
> > > > > This no matter if you are or not using LTW.
> > > > >
> > > > > If you have an AJC compiled @AspectJ aspect (thus in binary
> > > > > form) in your project path, you'll see that the aspectOf
> > > method does
> > > > > exist on the aspect class. AJC added it when compiling
> > > the aspect.
> > > > > Hence the client code can call it directly - but you can also
> > > > > use the helper methods.
> > > > > If the @AspectJ aspect was compiled with javac, then
> this method
> > > > > won't be there, so your only choice is to use the
> > > Aspects.aspectof
> > > > > helper.
> > > > > And from there again with or without LTW does not changes the
> > > > > situation.
> > > > >
> > > > > For regular code style aspect, the aspectOf method is
> implicit
> > > > > on the aspect itself, so you can call it. Then off course
> > > both aspect
> > > > > and client code will have to be compiled with AJC - and
> > > then you can
> > > > > use LTW without change.
> > > > >
> > > > > One situation can happen: if you have an @Aspect
> compiled with
> > > > > javac, and some client code using the Aspects.aspectOf
> > > helper. Then
> > > > > use that with LTW. If the @Aspect class is not exposed to
> > > the weaver
> > > > > for some reason (f.e. you are using a limited form of
> LTW), the
> > > > > actual aspectOf method cannot be added to the aspect
> > > class, and the
> > > > > helper method that reflectively invokes this method will
> > > thus fail.
> > > > > I think this is a rare case. The message you refer to
> > > unfortunately
> > > > > did not end up in a bug report. Feel free to open one if
> > > you have a
> > > > > reproductible scenario.
> > > > >
> > > > > Alex
> > > > >
> > > > >
> > > > > On 10/23/05, Yoav Landman <yoavl@xxxxxxxxxxxx> wrote:
> > > > > >
> > > > > > I am getting a similar behavior to what is described in
> > > > > >
> > > http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg04775.html.
> > > > > >
> > > > > > Using M4 and load time weaving, I am receiving a
> > > NoSuchMethodError
> > > > > > from a weaved class calling aspectOf() on my aspect class.
> > > > > >
> > > > > > I am trying to weave an external jar file. Compile time
> > > > > weaving using
> > > > > > ajc on the same jar works just fine.
> > > > > >
> > > > > > According to the docs, I thought that using LTW weaved
> > > classes are
> > > > > > supposed to call aspectOf() on the Aspects helper class and
> > > > > not on the aspect itself.
> > > > > >
> > > > > > Is this correct?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Yoav
> > > > > > _______________________________________________
> > > > > > 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
> > > >
> > > > _______________________________________________
> > > > 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
> >
> > _______________________________________________
> > 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