Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Aspectj and ClasCastException(Problem with aspectJ)
Aspectj and ClasCastException [message #1237778] Thu, 30 January 2014 15:11 Go to next message
Tony EMMA is currently offline Tony EMMAFriend
Messages: 2
Registered: January 2014
Junior Member
Hello,

I have a class
package test.toto;

public TotoClass{
  public void testMethode(){
     ...
  }
}


I create an aspect:

import test.toto.TotoClass;
public aspect TotoAspect{
	
	pointcut logMethod() : execution(* test.toto.TotoClass.testMethode(..));

	before(): logMethod(){
		TotoClass c = (TotoClass) thisJoinPoint.getThis();
	}
}



And i have a classcastexception:
test.toto.TotoClass cannot be cast to test.toto.TotoClass


I don't understand why. How to access to the instance of my class TototClass. Please someone can help me?

Thanks
Re: Aspectj and ClasCastException [message #1237936 is a reply to message #1237778] Fri, 31 January 2014 01:20 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
The reason this is happening is that your TotoClass is being loaded by different class loaders. I can't say why exactly, because I don't know your particular set up. It could be that you have the TotoClass on your classpath from two different locations.
Re: Aspectj and ClasCastException [message #1238049 is a reply to message #1237936] Fri, 31 January 2014 09:09 Go to previous message
Tony EMMA is currently offline Tony EMMAFriend
Messages: 2
Registered: January 2014
Junior Member
Ok, thanks

My application is a web application on tomcat. I launch my server with eclipse.
Previous Topic:Circular dependencies
Next Topic:Create a new Aspect wizard giving error in AJDT.
Goto Forum:
  


Current Time: Fri Apr 19 11:47:34 GMT 2024

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

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

Back to the top