Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ class format error

Andy,

This is only an issue with the annotation approach, the same Aspect works
with the code style.

The class in question, SnipClass, should not have been impacted by the
Aspect. Even after adding !within(com.snip3.SnipClass) the exception still
occurs.

I'll attempt to decompile and reproduce a test case for you but it is
proving a little hard to reproduce in an isolated environment.

Regards,

Jeff


On 1/4/08 10:52 pm, "Andy Clement" <andrew.clement@xxxxxxxxx> wrote:

> Could be an AspectJ bug.  I'm not sure which method in SnipClass has
> had code added to it and whether the AspectJ compiler was responsible
> for it - do you think SnipClass should be woven?  Are you able to see
> which method in SnipClass has been affected, by using javap?  Is the
> code that has been added refering to methods recognizable as AspectJ
> constructs? (eg. calling methods starting ajc$)
> 
> Have you tried the aspect as a code style aspect as opposed to an
> annotation style one?
> 
> Andy.
> 
> On 01/04/2008, Jeffrey Sinclair <jeff@xxxxxxxxxxxxxx> wrote:
>> aspectj-users,
>> 
>>  Can anyone shed any light on the following stack trace:
>> 
>>  Exception class: java.lang.ClassFormatErrorjava.lang.ClassFormatError: Code
>>  attribute in native or abstract methods in class file com/snip3/SnipClass
>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>>     at
>>  java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>     at java.net.URLClassLoader.access$100(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:306)
>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>     at com.snip2.CCDBMarshaller.setSnip(CCDBMarshaller.java:361)
>> 
>>     <...snip...>
>> 
>>     at
>>  com.snip1.subsnip1.CEReportRunner.processSnip(CEReportRunner.java:166)
>>     at
>>  com.snip1.subsnip1.CEReportRunner.run_aroundBody0(CEReportRunner.java:117)
>>     at
>>  com.snip1.subsnip1.CEReportRunner$AjcClosure1.run(CEReportRunner.java:1)
>>     at
>>  org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:101)
>>     at
>>  com.snip1.aspect.ReportTimingAspect.retAdvice(ReportTimingAspect.java:91)
>>     at com.snip1.subsnip1.CEReportRunner.run(CEReportRunner.java:91)
>>     at com.snip1.RunReport.runReport_aroundBody0(RunReport.java:154)
>>     at com.snip1.RunReport$AjcClosure1.run(RunReport.java:1)
>>     at
>>  org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:101)
>>     at
>>  com.snip1.aspect.ReportTimingAspect.tetAdvice(ReportTimingAspect.java:63)
>>     at com.snip1.RunReport.runReport(RunReport.java:148)
>>     at com.snip1.RunReport.main(RunReport.java:108)
>>   (com.snip1.subsnip1.CEReportRunner.run_aroundBody0)
>> 
>> 
>>  Is this a bug in the AspectJ compiler?
>> 
>>  The above was obtained using load-time weaving with the following aspect:
>> 
>>  @Aspect
>>  public class ReportTimingAspect
>>  {
>>   /**
>>    *  Pointcut definition for the RunReport entry point
>>    */
>>   @Pointcut("execution(* com.snip1.RunReport+.runReport(..)) &&
>>  !within(ReportTimingAspect)")
>>   public void totalPointcut()
>>   {
>>   }
>> 
>>   /**
>>    *  Pointcut definition for the ReportRunner.run() method
>>    */
>>   @Pointcut("execution(* com.snip1.ReportRunner+.run(..)) &&
>>  !within(ReportTimingAspect)")
>>   public void runnerPointcut()
>>   {
>>   }
>> 
>>   /**
>>    *
>>    * @param jp_
>>    */
>>   @Around("totalPointcut()")
>>   public Object tetAdvice(ProceedingJoinPoint jp_) throws Throwable
>>   {
>>     <...some code...>
>> 
>>     try
>>     {
>>     <...some code...>
>>       return jp_.proceed();
>>     }
>>     catch (Throwable t)
>>     {
>>       t.printStackTrace();
>>       throw t;
>>     }
>>     finally
>>     {
>>     <...some code...>
>>     }
>>   }
>> 
>>   /**
>>    *
>>    * @param jp_
>>    */
>>   @Around("runnerPointcut()")
>>   public Object retAdvice(ProceedingJoinPoint jp_) throws Throwable
>>   {
>>     <...some code...>
>>     try
>>     {
>>     <...some code...>
>>       return jp_.proceed();
>>     }
>>     finally
>>     {
>>     <...some code...>
>>     }
>>   }
>> 
>>  Any help is much appreciated.
>> 
>>  Regards,
>> 
>>  Jeff
>> 
>> 
>>  _______________________________________________
>>  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




Back to the top