Hi Andy.

Thanks for the helpful links.

I made a minimal test app and ran it twice - one with it set to fail and one
to pass (just commenting out a link that links to code that uses
HttpSession).

Here's a snipit from the *failure *pass:
[isolatedclassloa...@1b0889a] info register aspect
com.example.auditor.aspects.ClusterableHttpSessionAspect
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
org.springframework.mock.web.MockHttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'com.example.TempTest' (TempTest.java:34)
advised by before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57) [with runtime test]
[appclassloa...@92e78c] weaveinfo Join point 'method-execution(void
com.example.TempTest.test())' in Type 'com.example.TempTest'
(TempTest.java:32) advised by afterReturning advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:102)
[appclassloa...@92e78c] weaveinfo Join point 'method-execution(void
com.example.TempTest.test())' in Type 'com.example.TempTest'
(TempTest.java:32) advised by afterThrowing advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:142)

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.example.TempTest
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
javax.servlet.http.HttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'com.example.Temp' (Temp.java:8) advised by
before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57) [with runtime test]
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
org.springframework.mock.web.MockHttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'org.springframework.mock.web.MockHttpSession'
(MockHttpSession.java:161) advised by before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57) [with runtime test]
*[appclassloa...@92e78c] weaveinfo Extending interface set for type
'javax.servlet.http.HttpSession' (HttpSession.java) to include
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj)
*[appclassloa...@92e78c] info processing reweavable type
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession:
ca\gc\ic\auditor\aspects\ClusterableHttpSessionAspect.aj
[appclassloa...@92e78c] info successfully verified type
com.example.auditor.aspects.ClusterableHttpSessionAspect exists.  Originates
from
ca\gc\ic\auditor\aspects\C:\AMISDevTools\workspace\IC_Project_Auditor\src\main\aspect\ca\gc\ic\auditor\aspects\ClusterableHttpSessionAspect.aj
[appclassloa...@92e78c] weaveinfo Type
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj) has intertyped field from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.hashOnSet')
[appclassloa...@92e78c] weaveinfo Type
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj) has intertyped method from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.getHashOnSet()')
[appclassloa...@92e78c] info processing reweavable type
com.example.auditor.aspects.ClusterableHttpSessionAspect:
com\example\auditor\aspects\ClusterableHttpSessionAspect.aj
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.156 sec
<<< FAILURE!
test(com.example.TempTest)  Time elapsed: 1.844 sec  <<< ERROR!
java.lang.AbstractMethodError:
org.springframework.mock.web.MockHttpSession.getHashOnSet()Ljava/util/Map;
    at
com.example.auditor.aspects.ClusterableHttpSessionAspect.ajc$interMethodDispatch1$ca_gc_ic_auditor_aspects_ClusterableHttpSessionAspect$ca_gc_ic_auditor_aspects_ClusterableHttpSessionAspect$ClusterableHttpSession$getHashOnSet(ClusterableHttpSessionAspect.aj)

And here's a snipit from the "*success*" pass:
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
org.springframework.mock.web.MockHttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'com.example.TempTest' (TempTest.java:34)
advised by before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57) [with runtime test]
[appclassloa...@92e78c] weaveinfo Join point 'method-execution(void
com.example.TempTest.test())' in Type 'com.example.TempTest'
(TempTest.java:32) advised by afterReturning advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:102)
[appclassloa...@92e78c] weaveinfo Join point 'method-execution(void
com.example.TempTest.test())' in Type 'com.example.TempTest'
(TempTest.java:32) advised by afterThrowing advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:142)
*[appclassloa...@92e78c] weaveinfo Extending interface set for type
'javax.servlet.http.HttpSession' (HttpSession.java) to include
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj)*
[appclassloa...@92e78c] info processing reweavable type
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession:
ca\gc\ic\auditor\aspects\ClusterableHttpSessionAspect.aj
[appclassloa...@92e78c] info successfully verified type
com.example.auditor.aspects.ClusterableHttpSessionAspect exists.  Originates
from
ca\gc\ic\auditor\aspects\C:\AMISDevTools\workspace\IC_Project_Auditor\src\main\aspect\ca\gc\ic\auditor\aspects\ClusterableHttpSessionAspect.aj
[appclassloa...@92e78c] weaveinfo Type
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj) has intertyped field from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.hashOnSet')
[appclassloa...@92e78c] weaveinfo Type
'com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession'
(ClusterableHttpSessionAspect.aj) has intertyped method from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.getHashOnSet()')

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.example.TempTest
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
javax.servlet.http.HttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'com.example.Temp' (Temp.java:8) advised by
before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57)
[appclassloa...@92e78c] weaveinfo Type
'org.springframework.mock.web.MockHttpSession' (MockHttpSession.java) has
intertyped field from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.hashOnSet')
[appclassloa...@92e78c] weaveinfo Type
'org.springframework.mock.web.MockHttpSession' (MockHttpSession.java) has
intertyped method from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:'java.util.Map<java.lang.String,java.lang.Integer>
com.example.auditor.aspects.ClusterableHttpSessionAspect$ClusterableHttpSession.getHashOnSet()')
[appclassloa...@92e78c] weaveinfo Join point 'method-call(void
org.springframework.mock.web.MockHttpSession.setAttribute(java.lang.String,
java.lang.Object))' in Type 'org.springframework.mock.web.MockHttpSession'
(MockHttpSession.java:161) advised by before advice from
'com.example.auditor.aspects.ClusterableHttpSessionAspect'
(ClusterableHttpSessionAspect.aj:57)
[appclassloa...@92e78c] info processing reweavable type
com.example.auditor.aspects.ClusterableHttpSessionAspect:
com\example\auditor\aspects\ClusterableHttpSessionAspect.aj
org.springframework.mock.web.mockhttpsess...@332b9a
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.359 sec

For the success one, it looks like the code is only being weaved *after* the
tests have started.

I did not ask in the spring forums because this code isn't spring specific.
It's to test to make sure that apps will work well in a cluster wrt session
use.  Some of the apps that are using it are spring, some are struts, some
are a mix.

Jim


On Tue, Nov 10, 2009 at 8:27 PM, Andy Clement <[email protected]>wrote:

> Hi Jim,
>
> Whether the aspect can do the weaving (in this case change the
> parents) can depend upon which classloader loads the type targetted
> for weaving.  If you add '-debug' to the aop.xml weaver options
> section it will produce messages for which types the weaver is being
> passed for weaving (more details here:
> http://andrewclement.blogspot.com/2009/02/load-time-weaving-basics.html
> ).  If your HttpSession doesn't get passed to the weaver, you won't
> see a log entry and it must be getting loaded 'somewhere else' higher
> up.
>
> Are you able to target the MockHttpSession class instead? (if that is
> always being loaded by the correct loader)
>
> Did you try the Spring AOP forums:
> http://forum.springsource.org/forumdisplay.php?f=31 - lots of experts
> on there, in this kind of area.
>
> cheers,
> Andy
>
> 2009/11/10 Jim Sellers <[email protected]>:
> > Hi all.
> >
> > I'm having an issue where sometimes the "declare parents" code does not
> > properly change the parent of the class.
> >
> > Declare parents is set up on HttpSession.  When using spring's
> > MockHttpSession (which implements HttpSession), it seems that the parent
> > class doesn't get changed correctly, so it ends up with a
> > AbstractMethodError.
> > java.lang.AbstractMethodError:
> >
> org.springframework.mock.web.MockHttpSession.getHashOnSet()Ljava/util/Map;
> >
> > *However*, if HttpSession is in the non-test class that is being called
> by
> > the test, the declare parents command seems to run correctly.
> >
> > Has any one come across this?  I'm going a bit nuts because I can't seem
> to
> > figure out a consistent way to be able to get this working.
> >
> > Any help would be greatly appreciated.
> >
> > My original writeup of what I did:
> > http://www.beernut.ca/jim/archives/005157.html
> >
> > Thanks for your time,
> > Jim
> >
> > _______________________________________________
> > aspectj-users mailing list
> > [email protected]
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to