This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InvocationTargetException java.lang.NoSuchMethodError

 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting this error while executng a method through reflection.

java.lang.reflect.InvocationTargetException: java.lang.NoSuchMethodError

Where as the method is there inthe classs...


ANy other reasons You can think of?

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An InvocationTargetException with a NoSuchMethodError in it suggests a reflective call of a reflective call; sounds like some tricky code here.

But in any case, some method is there. The InvocationTargetException's "getCause()" method will return the NoSuchMethodError object itself; why not start by fetching that object, doing a printStackTrace() on it, and showing us the result. We'll work from there.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15274
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where as the method is there inthe classs...

Are you sure? Show us the code where you lookup and call the method, and the class that contains the method. Is the method public?
 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its working now, actually the method name in the exception was misleading.

That method does exists, but its calling a method in a pagebean, which actually is not present, reason being old class files for the pagebean.

Thanks a lot
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andy Smith:

That method does exists, but its calling a method in a pagebean, which actually is not present, reason being old class files for the pagebean.


Ah, great -- that's what I was anticipating above. Glad you figured it out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic