Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » java.lang.AbstractMethodError when invoking introduced method
java.lang.AbstractMethodError when invoking introduced method [message #52853] Fri, 03 June 2005 18:12 Go to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
The code I'm developing is a library, so I need my clients to be able to use it without any special aspectj/ajdt requirements (other than the runtime jar). So I have two projects:

drools-core - which is has the aspectj nature
drools-core-aspectjtest - which is a regular java project

the test project does not depend directly on the other, since it then does see the weaved classes. Rather, it includes the core project output directory (which should be good simulation for including a jar). Now, introduced methods can be used from regular java classes.

However, when I run my tests, I'm getting AbstractMethodError when I attempt to invoke an introduced method. In the core project, ajdt clearly indicates that the methods have been introduced on the concrete class that I am calling.

Any ideas how I can debug what is actually happening?

thanks

-barry
Re: java.lang.AbstractMethodError when invoking introduced method [message #52878 is a reply to message #52853] Fri, 03 June 2005 18:21 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Here are few more details.

The aspect contains:

private WorkingMemoryEventSupport WorkingMemory.eventSupport;

public void WorkingMemory.addListener(WorkingMemoryEventListener listener) {
eventSupport.addEventListener(listener);
}

public void WorkingMemory.removeListener(WorkingMemoryEventListener listener) {
eventSupport.removeEventListener(listener);
}


The concrete class that I'm using in my test is:

public ForTestWorkingMemory implements WorkingMemory ...

The weave message for ForTestWorkingMemory is:

Severity Description Resource In Folder Location Creation Time
0 Type 'org.drools.event.ForTestWorkingMemory' (ForTestWorkingMemory.java) has intertyped method from 'org.drools.event.WorkingMemoryChangeNotification' (WorkingMemoryChangeNotification.aj:'void org.drools.WorkingMemory.addListener(org.drools.event.Workin gMemoryEventListener)') drools-core June 3, 2005 11:03:32 AM


-barry
Re: java.lang.AbstractMethodError when invoking introduced method [message #52905 is a reply to message #52878] Fri, 03 June 2005 18:39 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
And also I added (just to make sure):

public void ForTestWorkingMemory.addListener(WorkingMemoryEventListener listener) {
eventSupport.addEventListener(listener);
}

But still I get the AbstractMethodError.
Re: java.lang.AbstractMethodError when invoking introduced method [message #52933 is a reply to message #52853] Fri, 03 June 2005 18:45 Go to previous messageGo to next message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
I created a very simple test within the 'drools-core' project (the one that has the aspectj nature). This test /can/ invoke the introduced methods. So it seems that only code in other projects gets the AbstractMethodError.


Surely I must be missing some kind of setup in the regular java project.
Re: java.lang.AbstractMethodError when invoking introduced method [message #52957 is a reply to message #52853] Fri, 03 June 2005 18:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adrian_colyer.uk.ibm.com

Barry Kaplan wrote:
> However, when I run my tests, I'm getting AbstractMethodError when I
> attempt to invoke an introduced method. In the core project, ajdt
> clearly indicates that the methods have been introduced on the concrete
> class that I am calling.
> Any ideas how I can debug what is actually happening?
>
> thanks
>
> -barry

The fact that your tests compile happily indicates that in the woven
class files, the method is there as expected. Likewise the fact that you
say everything works when you create a project dependency (which places
the output folders of the library project into both the compile time
*and* runtime classpaths of the dependent project) indicate that things
are pretty healthy.

The javadoc for AbstractMethodError says "this error can only occur at
runtime if the definition of some class has incompatibly changed since
the currently executing method was last compiled".

My guess for what is happening is that you have the output folder of the
library project on your classpath for compilation, but that when you
run the tests this output folder is *not* on the runtime classpath.
Instead, at runtime you are picking up another (unwoven) version of the
library classes from somewhere else on your classpath.

Could this be the case?
Re: java.lang.AbstractMethodError when invoking introduced method [message #52979 is a reply to message #52957] Fri, 03 June 2005 18:53 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
> My guess for what is happening is that you have the output folder of the
> library project on your classpath for compilation, but that when you
> run the tests this output folder is *not* on the runtime classpath.
> Instead, at runtime you are picking up another (unwoven) version of the
> library classes from somewhere else on your classpath.
>
> Could this be the case?

I don't see how. There is only one output directory(*). But... Here's what I just did:

- Added the aspectj nature to the test project
- Test runs fine!
- Remove aspectj nature from the test project
- Compile errors because aspectjrt.jar is missing (I was using AspectOf)
- Added the aspectjrt.jar
- Test runs fine!

So, clearly some class fud was going on. I pretty regularly have to recompile the whole project and/or restart eclipse when using ajdt. Is there any class caching going on somewhere?

But for now, its working. I try to be observant as to what triggers my compilation fud.

thanks!!

(*) This brings up another issue. I would like to direct the production code to one output directory, and the test to another. This is possible with the java nature, but not the aspectj nature. Need this be the case? I must say, that I don't find any benefit to the way ajdt changes the way files are included/excluded from the build.

-barry
Re: java.lang.AbstractMethodError when invoking introduced method [message #588577 is a reply to message #52853] Fri, 03 June 2005 18:21 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
Here are few more details.

The aspect contains:

private WorkingMemoryEventSupport WorkingMemory.eventSupport;

public void WorkingMemory.addListener(WorkingMemoryEventListener listener) {
eventSupport.addEventListener(listener);
}

public void WorkingMemory.removeListener(WorkingMemoryEventListener listener) {
eventSupport.removeEventListener(listener);
}


The concrete class that I'm using in my test is:

public ForTestWorkingMemory implements WorkingMemory ...

The weave message for ForTestWorkingMemory is:

Severity Description Resource In Folder Location Creation Time
0 Type 'org.drools.event.ForTestWorkingMemory' (ForTestWorkingMemory.java) has intertyped method from 'org.drools.event.WorkingMemoryChangeNotification' (WorkingMemoryChangeNotification.aj:'void org.drools.WorkingMemory.addListener(org.drools.event.Workin gMemoryEventListener)') drools-core June 3, 2005 11:03:32 AM


-barry
Re: java.lang.AbstractMethodError when invoking introduced method [message #588587 is a reply to message #52878] Fri, 03 June 2005 18:39 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
And also I added (just to make sure):

public void ForTestWorkingMemory.addListener(WorkingMemoryEventListener listener) {
eventSupport.addEventListener(listener);
}

But still I get the AbstractMethodError.
Re: java.lang.AbstractMethodError when invoking introduced method [message #588596 is a reply to message #52853] Fri, 03 June 2005 18:45 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
I created a very simple test within the 'drools-core' project (the one that has the aspectj nature). This test /can/ invoke the introduced methods. So it seems that only code in other projects gets the AbstractMethodError.


Surely I must be missing some kind of setup in the regular java project.
Re: java.lang.AbstractMethodError when invoking introduced method [message #588604 is a reply to message #52853] Fri, 03 June 2005 18:46 Go to previous message
Adrian Colyer is currently offline Adrian ColyerFriend
Messages: 61
Registered: July 2009
Member
Barry Kaplan wrote:
> However, when I run my tests, I'm getting AbstractMethodError when I
> attempt to invoke an introduced method. In the core project, ajdt
> clearly indicates that the methods have been introduced on the concrete
> class that I am calling.
> Any ideas how I can debug what is actually happening?
>
> thanks
>
> -barry

The fact that your tests compile happily indicates that in the woven
class files, the method is there as expected. Likewise the fact that you
say everything works when you create a project dependency (which places
the output folders of the library project into both the compile time
*and* runtime classpaths of the dependent project) indicate that things
are pretty healthy.

The javadoc for AbstractMethodError says "this error can only occur at
runtime if the definition of some class has incompatibly changed since
the currently executing method was last compiled".

My guess for what is happening is that you have the output folder of the
library project on your classpath for compilation, but that when you
run the tests this output folder is *not* on the runtime classpath.
Instead, at runtime you are picking up another (unwoven) version of the
library classes from somewhere else on your classpath.

Could this be the case?
Re: java.lang.AbstractMethodError when invoking introduced method [message #588608 is a reply to message #52957] Fri, 03 June 2005 18:53 Go to previous message
Barry Kaplan is currently offline Barry KaplanFriend
Messages: 230
Registered: July 2009
Senior Member
> My guess for what is happening is that you have the output folder of the
> library project on your classpath for compilation, but that when you
> run the tests this output folder is *not* on the runtime classpath.
> Instead, at runtime you are picking up another (unwoven) version of the
> library classes from somewhere else on your classpath.
>
> Could this be the case?

I don't see how. There is only one output directory(*). But... Here's what I just did:

- Added the aspectj nature to the test project
- Test runs fine!
- Remove aspectj nature from the test project
- Compile errors because aspectjrt.jar is missing (I was using AspectOf)
- Added the aspectjrt.jar
- Test runs fine!

So, clearly some class fud was going on. I pretty regularly have to recompile the whole project and/or restart eclipse when using ajdt. Is there any class caching going on somewhere?

But for now, its working. I try to be observant as to what triggers my compilation fud.

thanks!!

(*) This brings up another issue. I would like to direct the production code to one output directory, and the test to another. This is possible with the java nature, but not the aspectj nature. Need this be the case? I must say, that I don't find any benefit to the way ajdt changes the way files are included/excluded from the build.

-barry
Previous Topic:java.lang.AbstractMethodError when invoking introduced method
Next Topic:AJDT 1.2.0RC2 released for Eclipse 3.0
Goto Forum:
  


Current Time: Sat Apr 20 00:03:52 GMT 2024

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

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

Back to the top