wood burning stoves 2.0*
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
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.
 
wood burning stoves
 
subject: Reflection Problem - I feel like a Vampire... No reflection found...