jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Reflection Problem - I feel like a Vampire... No reflection found... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Reflection Problem - I feel like a Vampire... No reflection found..." Watch "Reflection Problem - I feel like a Vampire... No reflection found..." New topic
Author

Reflection Problem - I feel like a Vampire... No reflection found...

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Hoping that someone may be able to help me make sense out of this. I'm doing some basic reflective calls that keep failing on the method.invoke().

Servlet call:


which calls:


which fails on the invoke:


here's the error message:


It had worked before... I'm not quite sure what I've done wrong.

TIA
[ March 19, 2007: Message edited by: graham king ]

write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Graham,

can you post (some of) the code of the method(s) from AutoCompleteDel that you want to call?

Herman
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Servlet containers are tricky places: there is more than one ClassLoader in use, and seemingly weird things happen if the same class gets loaded by two different ClassLoaders. It's possible that this is what's happened here.

You might try logging the result of "method.getDeclaringClass().getClassLoader() == obj.getClass().getClassLoader()". You'd like this to be true. If it's false, then that explains your problem.


[Jess in Action][AskingGoodQuestions]
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Thanks, Earnest. Thought I was loosing my head. I rewrote the servlet call to work directly with the MirrorMaker class and found that I did indeed have a class loading issue, mainly a lingering .jar file in my WEB-INF/lib dir. I haven't put it back to how it was yet, I'll try it later, but, by removing it from the lib things are doing ok.

Thanks again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Reflection Problem - I feel like a Vampire... No reflection found...
 
Similar Threads
Fill bean data from HashMap using Reflection
reflection and overloading, java.lang.IllegalArgumentException: wrong number of arguments
Handler Class - Is it correct?
super of super
Limit on Data/Key-Value Pairs in Form Submission