Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » NoClassDefFoundError with Aspectj 1.2 (upd) on Eclipse 2.1.3
NoClassDefFoundError with Aspectj 1.2 (upd) on Eclipse 2.1.3 [message #582457] Mon, 02 August 2004 06:36
Christian Eugster is currently offline Christian EugsterFriend
Messages: 203
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hello

I am using Eclipse 2.1.3, have ajdt 1.4 installed and updated for Aspectj
1.2. Because I am new to aspect-oriented Programming, I tried to implement
first a logging aspect as I learned by "AspectJ in action" (see the source
below). I can ompile the whole code without problems, but running the
example I get always an NoClassDefFoundError. This Error occures at the
first place, where i use one of my core classes named Path, that has some
static String constants containing pathnames to the system. Without aspectj
the project runs problemless.

I searched the web, found an entry in the bugzilla tool for eclipse
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=44587) but that points to
ajdt 1.4 without update. Has anybody any idea how I could solve that
problem? Thank you in advance!

Christian

/*

* Created on 21.07.2004

*

* To change the template for this generated file go to

* Window>Preferences>Java>Code Generation>Code and Comments

*/

package ch.eugster.pos;

import ch.eugster.pos.client.event.ExceptionThrownDelegate;

import ch.eugster.pos.client.event.ExceptionThrownEvent;

import ch.eugster.pos.util.Path;

import java.io.IOException;

import java.lang.SecurityException;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.logging.FileHandler;

import java.util.logging.Level;

import java.util.logging.Logger;

import java.util.logging.SimpleFormatter;

import org.aspectj.lang.Signature;



/**

* @author ceugster

*

* To change the template for this generated type comment go to

* Window>Preferences>Java>Code Generation>Code and Comments

*/

public aspect LoggingAspect {


private Logger _logger = Logger.getLogger("logging");

private Level level = Level.SEVERE;


LoggingAspect() {

_logger.setLevel(level);


try {

FileHandler fh = new FileHandler(Path.logDir.concat(Path.FILE_LOG), true);

fh.setFormatter(new SimpleFormatter());

}

catch (IOException e) {

}

catch (SecurityException e) {

}

catch (ExceptionInInitializerError e) {

}

}


pointcut traceMethods()

: execution(* *(..)) && !within(LoggingAspect);


before() : traceMethods() {

if (_logger.isLoggable(Level.INFO)) {

Signature sig = thisJoinPointStaticPart.getSignature();

_logger.logp(Level.INFO,

sig.getDeclaringType().getName(),

sig.getName(),

"Entering: " + sig.getDeclaringType().getName() + "." + sig.getName());

}

}


after() : traceMethods() {

if (_logger.isLoggable(Level.INFO)) {

Signature sig = thisJoinPointStaticPart.getSignature();

_logger.logp(Level.INFO,

sig.getDeclaringType().getName(),

sig.getName(),

"Leaving: " + sig.getDeclaringType().getName() + "." + sig.getName());

}

}

pointcut exceptionLogMethods()

: execution(* *(..)) && !within(LoggingAspect);


after() throwing(Throwable ex) : exceptionLogMethods() {

if (_logger.isLoggable(Level.WARNING)) {

Signature sig = thisJoinPointStaticPart.getSignature();

_logger.logp(Level.WARNING,

sig.getDeclaringType().getName(),

sig.getName(),

"Exception thrown: " +

ex.getLocalizedMessage());

}

DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT,
SimpleDateFormat.SHORT);

ExceptionThrownDelegate.fireExceptionThrownEvent(new
ExceptionThrownEvent(df.format(new Date()) + ": Exception thrown - " +
ex.getLocalizedMessage() + "\n"));

}


}
Previous Topic:AJDT 1.1.11 released for Eclipse 3.0
Next Topic:NoClassDefFoundError with Aspectj 1.2 (upd) on Eclipse 2.1.3
Goto Forum:
  


Current Time: Thu Apr 25 10:57:48 GMT 2024

Powered by FUDForum. Page generated in 0.02771 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top