Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] NoClassDefFoundError

Just an FYI for anyone who is used to the JDT behaviour where it
builds broken code into valid .class files.  AspectJ now supports this
and so in forthcoming AJDT builds you won't have to exclude the broken
source files.  We do not weave the broken files, however.

cheers,
Andy.

2008/6/7 Andy Clement <andrew.clement@xxxxxxxxx>:
> Unlike the JDT, we don't like building code when there are errors.
> The JDT will produce class files containing code that will throw
> errors when called for errors that existed in the source. AspectJ will
> not do that right now.  Unlike JDT we have an additional step after
> compilation called weaving where pointcuts are matched and advice is
> applied - we currently require the input to that weaving process to be
> valid code with no errors.  As I mentioned in my other post, the
> current option you have is excluding the broken files using the
> eclipse exclude mechanism.
>
> cheers,
> Andy.
>
> 2008/6/7  <joel@xxxxxxxxxxx>:
>> I created a very basic test case that calls one of our methods in a
>> project with many classes. I do not have any aspects. If I execute it
>> with AspectJ enabled on the project, I get the stacktrace below. If I
>> turn off AspectJ Capability then it runs just fine. I looked in the
>> output directory and the class does exist either way.
>>
>> There are some compile errors in the project but that shouldn't affect
>> running the code because it works when AspectJ is turned off.
>>
>> Any ideas how to fix this? Thanks.
>>
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: my.DepClass
>> at java.lang.ClassLoader.defineClass1(Native Method)
>> at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>> at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:289)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>> at MyClass.main(ModelChangeTest.java:23)
>> Caused by: java.lang.ClassNotFoundException: my.DepClass
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:289)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>> ... 13 more
>>
>>
>>
>> 16:44:55 ===========================================================================================
>> 16:44:55 Build kind = AUTOBUILD
>> 16:44:55 Project=AnalystServices, kind of build requested=Incremental
>> AspectJ compilation
>> 16:44:55 build: Examined delta - source file changes in required
>> project AnalystServices
>> 16:44:56 Preparing for build: not going to be incremental because no
>> successful previous full build
>> 16:44:56 Falling back to batch compilation
>> 16:44:56 Preparing for build: not going to be incremental because no
>> successful previous full build
>> 16:45:1 Timer event: 5740ms: Time to first compiled message
>> 16:45:1 Timer event: 5780ms: Time to first woven message
>> 16:45:50 AJDE Callback: finish. Was full build: true
>> 16:45:50 Timer event: 54889ms: Total time spent in AJDE
>> 16:45:54 Timer event: 3856ms: Create element map (0 rels in project:
>> AnalystServices)
>> 16:45:55 Types affected during build = 1191
>> 16:45:58 Timer event: 0ms: Add markers (0 markers)
>> 16:45:58 Timer event: 62809ms: Total time spent in AJBuilder.build()
>> 16:54:48 ===========================================================================================
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>


Back to the top