[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] binary weaving not working on some class files
|
Hi David,
I'm also facing these errors quite often. The problem is that it is
trying to weave a class that does not have all the needed elements in
the classpath. I can see that you have an ant task in your classpath, is
ant also in your classpath?
This happens quite frequently when weaving third party jars, cause quite
often not all dependencies are present. For example, I encountered this
error recently weaving OpenJPA : they have database dictionary classes
that uses JDBC drivers inside, for example the MySqlDictionary uses
classes from the MySql driver, the PostgresDictionary uses classes from
the Postgres driver and so no. When AspectJ analyzes a class to
determine if and where pointcuts apply, it needs to find all other
classes used by that class. Obviously, since Iìm developing on MySql, i
only had the MySql driver on the classpath, so all other OpenJPa
dictionaries were failing the weaving process.
This is in contrast with what happens when you USE the classes in a
runtime environment. In that case Java will load classes only when
needed, so a missing class used in a method you are never going to call
is not a problem, but the weaver still needs to analyze also those
methods, and cannot determine if you are going to call it or not.
As a quick resolution, try to put the relevant ANT classes on your
classpath. Unfortunately I cannot with different versions of AspectJ
working properly.
Hope this helps,
Simone
David Mohr wrote:
> Hi,
> I have been using binary weaving (ajc with -inpath and -aspectpath)
> for some projects, but sometimes ajc does not weave the aspects for
> some class files.
>
> To be more specific, I'm trying to add an interface to all user defined classes:
>
> public aspect AddInterface {
> declare parents: !java..* && !edu.unm.cs.oal.sharing.* &&
> !org.aspectj..* implements Subject;
> }
>
> When I try to binary-weave this aspect with
> # ajc -XnotReweavable -inpath in/ -aspectpath aspect/ -d out/
> I get the following errors:
>
> ---SNIP---
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.Task
> when processing declare parents net.sourceforge.pmd.cpd.CPDTask
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.Task
> when processing declare parents net.sourceforge.pmd.cpd.CPDTask
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.types.EnumeratedAttribute
> when processing declare parents net.sourceforge.pmd.cpd.CPDTask$FormatAttribute
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.types.EnumeratedAttribute
> when processing declare parents net.sourceforge.pmd.cpd.CPDTask$FormatAttribute
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.Task
> when processing declare parents net.sourceforge.pmd.ant.PMDTask
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.Task
> when processing declare parents net.sourceforge.pmd.ant.PMDTask
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.types.EnumeratedAttribute
> when processing declare parents
> net.sourceforge.pmd.cpd.CPDTask$LanguageAttribute
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> /nfs/home/home1/dmohr/svn/alg-opt/trunk/david/sharing/bw-bug/in/net/sourceforge/pmd/dfa/pathfinder/PathElement.class
> [error] can't determine implemented interfaces of missing type
> org.apache.tools.ant.types.EnumeratedAttribute
> when processing declare parents
> net.sourceforge.pmd.cpd.CPDTask$LanguageAttribute
> when processing type mungers
> when weaving
> when batch building BuildConfig[null] #Files=0
> [Xlint:cantFindType]
> (no source information available)
> [Xlint:cantFindType]
> ---SNAP---
>
> So in 1.6.2, net/sourceforge/pmd/dfa/pathfinder/PathElement.class is
> not even copied over to the output folder, while in 1.6.1 it was
> correctly woven (I did specify -Xnot
>
> Yet there are classes not mentioned in any of these error messages,
> where the aspect does not get woven! That class does get copied into
> the output folder on all aspectj versions which I tried.
>
> Should I post the -showWeaveInfo log, or rather upload the files somewhere?
>
> Thanks for any help!
>
> ~David
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
--
Simone Gianni CEO Semeru s.r.l. Apache Committer
MALE human being programming a computer http://www.simonegianni.it/