Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] RE: Running AspectJ with Tomcat and Axis

Aspect
public aspect Logger {
	
	String klass, method = "";
	
	pointcut tueEtwas():
		execution (* *.*(..)) && !within(Logger);
	
	after() returning : tueEtwas() {
		Signature sig = thisJoinPointStaticPart.getSignature();
		klass = sig.getDeclaringType().getName();
		method = sig.getName();
		System.out.println ("Entering: "+klass+","+method);
		
		
		String root = "";
		
		
			if (klass.equals("Task")) {
				if (method.equals("addTask")) {
					System.out.println("in add TAsk");
					System.out.println("taskname: "+Task.task.getName());
					System.out.println("taskdescription: "+Task.task.getDescription());
					Logs logs = new Logs();
					Vector elemente = new Vector();
					elemente.add("element1");
					Vector daten = new Vector();
					daten.add("Dies isst der Inhalt von Element 1");
					logs.writeLogsToXML("root", elemente, daten, "log.xml");
				}
		}
	}
}	

The class Logs writes a XML File with the specified Log Data.
This function should be called if the method is addTask();
The log class functions well and all functions when i try to run it without
web service.



Class Task

public class Task {
	
	private String name="";
	private String description="";
	
	public static Task task = new Task();
	
	
	
	
	public String getName () {
		return this.name;
	}
	
	public void setName (String name) {
		this.name = name;
	}
	
	public String getDescription () {
		return this.description;
	}
	
	public void setDescription (String description) {
		this.description = description;
	}
	
		
	public void addTask(String name, String description) {
		Task.task.setName(name);
		Task.task.setDescription(description);
	}
	
	
}


Main Class on the Client

public class Test5 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		TaskService serviceTask = new TaskServiceLocator();
		
		try {
			Task_PortType stubTask = serviceTask.getTask();
		
			try {
				stubTask.addTask("rolandstask","adlsöfkskdf");
			}
			catch (java.rmi.RemoteException f) {
				
			}
		}
		catch (javax.xml.rpc.ServiceException e) {
			
		}
	}
}


Now, at least, I receive some output when I put the -showWeaveInfo OPtion
with ajc, but the XML-File is not be written.

Roland


Ron DiFrango wrote:
> 
> Can you supply your pointcuts? And some example code?
>  
> Ron DiFrango
> 
> 
> ________________________________
> 
> From: aspectj-users-bounces@xxxxxxxxxxx on behalf of rolando80
> Sent: Fri 4/13/2007 11:27 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Running AspectJ with Tomcat and Axis
> 
> 
> 
> 
> Yes nothng is logged when -showWeaveInfo doesn't produce any output.
> 
> But whats the reason? I've searched almost the whole internet on that
> problem and all I've found is that to put the aspectjrt.jar into
> web-inf/lib
> what I've done.
> 
> Can anyone please help me?
> 
> Thanks
> 
> 
> rolando80 wrote:
>>
>> no there aren't special things to specify into a tomcat file, there is
>> only to move aspectjrt.jar into web-inf/lib directory.
>>
>> but the -showWeaveInfo does not produce output, what means that there is
>> nothing that has been logged?
>>
>> roland
>>
>>
>> rolando80 wrote:
>>>
>>> Hi!
>>>
>>> I want to WebServices use an Aspect for logging specific Methods.
>>> Everything seems ok with the Aspect and the rest of the code.
>>>
>>> Are there special things to modify in some tomcat file that AspectJ
>>> runs?
>>>
>>> And if not how do i test AspectJ on the server, because
>>> System.out.println runs only on the client...?
>>>
>>> Thanks,
>>> Roland
>>>
>>
>>
> 
> --
> View this message in context:
> http://www.nabble.com/Running-AspectJ-with-Tomcat-and-Axis-tf3565829.html#a9981063
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> 
> _______________________________________________
> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/Running-AspectJ-with-Tomcat-and-Axis-tf3565829.html#a9981633
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top