Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] another 'noaspectboundexception: exception while initializing ....'. plz help

Hi,

Your snippet of code says POJOAspect is in package test.  But your
stack trace says it is in package test.aspects.  Your !within(test.*)
will not exclude the aspect if it is in test.aspects, since you only
include one '.'.

Caused by: org.aspectj.lang.NoAspectBoundException: test_aspects_POJOAspect
       at test.aspects.POJOAspect.aspectOf(POJOAspect.aj:1)
       at test.StartServer.startThread(StartServer.java:37)
       at test.aspects.GenericAspect.<init>(GenericAspect.aj:15)
       at test.aspects.POJOAspect.<init>(POJOAspect.aj:11)
       at test.aspects.POJOAspect.ajc$postClinit(POJOAspect.aj:1)
       at test.aspects.POJOAspect.<clinit>(POJOAspect.aj:11)

This piece of the stack suggests that an attempt is being made to call
something that is advised whilst the aspect instance is being
constructed.  Your startThread() code is trying to access the aspect
before it has finished being constructed.  You could try reorganizing
that logic (don't call startThread from the genericaspect constructor)
or you could try a cflow to avoid the advice call in startThread if in
the cflow of the aspects constructor.

Andy

On 17 August 2010 07:54, Ashank <k_arvind_shankar@xxxxxxxxx> wrote:
>
> Hello All!
>
> I am using LTW with AJ 1.6.9. I'm trying to instrument any interesting POJO
> class in my web app and I wrote this pointcut for this (partial aspect
> enclosed)
> <snip>
> package test;
>
> public aspect POJOAspect extends GenericAspect{
>        public pointcut POJOPC() :
>                !within(test.*) &&
>                !execution(public new(..)) &&
>        !(execution(* java..*(..)) || execution(java..new(..))) &&
>        !(execution(native * *(..)) || execution(native new(..))) &&
>                execution(public * *(..));
> </snip>
>
> GenericAspect is just an abstract dummy aspect that I use to do stuff for my
> web app. All my aspects extend it. Some pointcuts in my aspect may be
> redundant but I'm just pasting it here as they are in my code.
>
> When I ran my web server, I get the following exception
>
> org.aspectj.lang.NoAspectBoundException: Exception while initializing
> test_aspects_POJOAspect: org.aspectj.lang.NoAspectBoundException:
> test_aspects_POJOAspect
>        at test.aspects.POJOAspect.aspectOf(POJOAspect.aj:1)
>        at
> org.apache.ajp.tomcat4.Ajp13Connector.setContainer(Ajp13Connector.java:403)
>        at
> org.apache.catalina.core.StandardService.addConnector(StandardService.java:245)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
>        at
> org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
>        at
> org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
>        at
> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
>        at
> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
>        at
> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
>        at
> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1809)
>        at
> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1182)
>        <......snipped........./>
>
> Caused by: org.aspectj.lang.NoAspectBoundException: test_aspects_POJOAspect
>        at test.aspects.POJOAspect.aspectOf(POJOAspect.aj:1)
>        at test.StartServer.startThread(StartServer.java:37)
>        at test.aspects.GenericAspect.<init>(GenericAspect.aj:15)
>        at test.aspects.POJOAspect.<init>(POJOAspect.aj:11)
>        at test.aspects.POJOAspect.ajc$postClinit(POJOAspect.aj:1)
>        at test.aspects.POJOAspect.<clinit>(POJOAspect.aj:11)
>        at
> org.apache.ajp.tomcat4.Ajp13Connector.setPort(Ajp13Connector.java:574)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.catalina.util.xml.SetProperties.setProperty(XmlMapper.java:703)
>        at
> org.apache.catalina.util.xml.SetProperties.start(XmlMapper.java:650)
>        at
> org.apache.catalina.util.xml.XmlMapper.matchStart(XmlMapper.java:412)
>        at
> org.apache.catalina.util.xml.XmlMapper.startElement(XmlMapper.java:91)
>        at
> org.xml.sax.helpers.XMLReaderAdapter.startElement(XMLReaderAdapter.java:329)
>        at
> org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
>        at
> org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1284)
>        at
> org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1806)
>       <....snipped...../>
>
> I checked out a bunch of posts about noaspectboundexception and about cyclic
> advising but don't know how I am facing that issue (if at all) when I am not
> advising any class in the test package (where my POJOAspect resides).
> Please help!!!
> Thank you very much
>
>
> -Arvind
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/another-noaspectboundexception-exception-while-initializing-plz-help-tp2328492p2328492.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top