rachna (1) [Avatar] Offline
#1
I am trying to use Aspect to replace Logging/Tracing feature of my product. I am having following issues and I need your help to resolve the issues.

1. I could run and start simple System.out.println type of Aspect just fine. But for my application I need to have a handle of the LogUtils object. LogUtils objects called another class Resource class to get the file path and other informations. The code look something like this
public static LogUtils logUtility(){
TwineBallResourceAdapter ra = new TwineBallResourceAdapter();
LogUtils utils =null;
try{
ra.setLogFilename("LOG.LOG");
ra.setTraceFilename("TRACE.TRACE");
ra.setBONamespace("http://sample/j2c/customer");
utils = new LogUtils(ra, false);
}catch(Exception e){
e.printStackTrace();
}
System.out.println("*********** before returning getlogutils");
return utils;
}
LogUtils construction calls ResourceMetadata rMetadata = ra.getResourceMetadata();
where
public ResourceMetadata getResourceMetadata() throws ResourceException {
return new TwineBallResourceMetaData(this);
}
reference of this is understood by Aspect as a reference to Aspect so Aspect is throwing NoAspectBoundException.

2. If I create a new class LoggerUtility and call public static LogUtils logUtility() method with all the above functionality so that we get the handle by invoking the class Logger.LogUtility() in the constructor the Aspect then also I am getting NoAspectBoundException.

Can you please help me resolve this issue.