Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] What a class is not found?

I'd strongly suggest you change your aspect to use:

  after() returning: allMethodsCut()
instead of
  after(): allMethodsCut()

(Yes, I know this is from the example code.  I also think the example code needs to be changed.)

Just like finally clauses in Java, straight after advice can sometimes do strange things to exception traces by replacing one with another.  For a little more about after and finally, see the FAQ at:

http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/faq.html#q:infiniterecursion

-Jim

> -----Original Message-----
> From: Pavel Sozonovsky [mailto:Pavel.Sozonovsky@xxxxxxxxxxxxxxx]
> Sent: Wednesday, March 26, 2003 4:51 AM
> To: 'aspectj-users@xxxxxxxxxxx'
> Subject: [aspectj-users] What a class is not found?
> 
> Hello All!
> 
> I'm newbie in AspectJ and my first expirience was not successfull. Please
> help me to understand where i was mistaken.
> 
> I tried to compile my classes with a light modified aspect Debug from
> examples. I simple
> replace package chain to my one (com.caeconsult.integrate.iui.ui.*).
> 
> Here it is:
> -----------------------------------
> package tracing.test;
> 
> import javax.swing.*;
> import java.awt.TextArea;
> import java.awt.Dimension;
> 
> aspect Debug
> {
>     private static InfoWin infoWin = new InfoWin();
> 
>     /*
>      * all methods
>      */
>     pointcut allMethodsCut():
>         execution(* (com.caeconsult.integrate.iui.ui.* && !(Debug+ ||
> InfoWin+)).*(..));
> 
>     before(): allMethodsCut()
>     {
>         infoWin.println("entering " + thisJoinPoint.getSignature());
>     }
>     after(): allMethodsCut()
>     {
>         infoWin.println("exiting " + thisJoinPoint.getSignature());
>     }
> }
> 
> class InfoWin {
>     private JFrame    frame;
>     private JTextArea info;
> 
>     InfoWin() {
>         frame = new JFrame("debugging info for spacewar game");
>         info = new JTextArea();
>         info.setEditable(false);
> 
>         Dimension screenSize = frame.getToolkit().getScreenSize();
>         frame.setSize(250, 600);
>         frame.setLocation(screenSize.width - 250, 0);
>         frame.add(info);
>         frame.show();
>         frame.toFront();
>     }
> 
>     void clear() {
>         info.setText("");
>     }
> 
>     void println(String line) {
>         info.append(line + "\n");
>     }
> 
>     void print(String line) {
>         info.append(line);
>     }
> }
> -----------------------------------
> 
> I was successfull to compile all the code with the next ant script:
> -----------------------------------
>  ....
>  <target name="compile_with_aspects">
>     <iajc destdir="${buildPath}" verbose="true" sourceRoots=".">
>       <!-- declare classes needed to compile the target files -->
>       <classpath>
>         <pathelement location="d:/aspectJ_1.1b4/lib/aspectjrt.jar"/>
>         <pathelement location="d:/aspectJ_1.1b4/lib/aspectjtools.jar"/>
>         <pathelement
> location="D:\Sandbox\CAE\Integrate\java_cae_common\classes\com-lib.jar"/>
>         <pathelement
> location="D:\Sandbox\CAE\Integrate\IUI\classes\oromatcher.jar"/>
>         <pathelement
> location="D:\Sandbox\CAE\Integrate\IUI\classes\xercesImpl.jar"/>
>         <pathelement
> location="D:\Sandbox\CAE\Integrate\IUI\classes\xmlParserAPIs.jar"/>
>         <pathelement location="C:\idea807\lib\junit.jar"/>
>       </classpath>
>     </iajc>
>   </target>
>   ....
> ------------------------------------
> 
> But when I tried to execute new code (tatally new, I deleted all old
> classes
> before compilation)
> I got en error:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError
>         at
> com.caeconsult.integrate.iui.ui.fmMain.getInstance(fmMain.java:140)
>         at com.caeconsult.integrate.iui.iuiMain.<init>(iuiMain.java:61)
>         at com.caeconsult.integrate.iui.iuiMain.main(iuiMain.java:166)
> 
> It looks strange imho because it is not full message about exception.
> But the rest of message is not shown, it just hangs.
> And... this error is absent if I recompile all code without aspect.
> 
> Any ideas?
> 
> I use aspectJ 1.1 beta4, may be problem here?
> 
> Thanx
> 
> Pavel
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top