Skip to main content



      Home
Home » Language IDEs » AspectJ » Aspectj and ClasCastException(Problem with aspectJ)
Aspectj and ClasCastException [message #1237778] Thu, 30 January 2014 10:11 Go to next message
Eclipse UserFriend
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] Thu, 30 January 2014 20:20 Go to previous messageGo to next message
Eclipse UserFriend
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 04:09 Go to previous message
Eclipse UserFriend
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: Wed May 21 11:55:15 EDT 2025

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

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

Back to the top