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?

Hi Jim, Ron!
Thanx for your advices.

I changed my aspect. 
I also downloaded aspectJ1.1 release candidat 1.

It didn't help.

But I found out that if I don't use one class, it works fine,
and if I use it, it falls down with the following error:

Exception in thread "main" java.lang.NoClassDefFoundError:
java/awt/AWTKeyStroke

        at com.caeconsult.common.ui.RDMenuItem.setUI(RDMenuItem.java:22)
        at javax.swing.JMenuItem.updateUI(JMenuItem.java:197)
        at javax.swing.JMenuItem.init(JMenuItem.java:159)
        at javax.swing.JMenuItem.<init>(JMenuItem.java:122)
        at javax.swing.JMenuItem.<init>(JMenuItem.java:100)
        at com.caeconsult.common.ui.RDMenuItem.<init>(RDMenuItem.java:33)
        at
com.caeconsult.integrate.iui.ui.custom.XmlMenuLoader.defineMenuItem(X
mlMenuLoader.java:317)....

So at least now it says class name, so topic is obsolete :).

Unfortunately, I haven't time to play with it and find a cause by myself. 
But as I'm going to use only design aspects at this time, so there is no 
big problem now.

Is there anybody, who can explain, what is going wrong?
It is not urgent absolutly, I just want to understand...

Thanx for your help,
Pavel.

P.S. The class, including of which cause an error, is attached. It is a
simple
extended menuitem UI to show menuitem as I prefer.

> -----Original Message-----
> From: Jim.Hugunin@xxxxxxxx [mailto:Jim.Hugunin@xxxxxxxx]
> Sent: Friday, March 28, 2003 8:23 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: 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~/aspect
> j-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
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 

Attachment: RDMenuItemUI.java
Description: Binary data


Back to the top