tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject instanceof drives me nuts!
Date Fri, 31 Oct 2003 14:35:35 GMT
Hi folks,

It may be an off topic question but such weird things occurs in my tomcat 
project that posting here is my last chance...

I took over a project for global authentication in my company extending 
standard tomcat authentication mecanism (extending AuthenticatorBase).
As I didn't build the project, I am not so familiar with it and I couldn't 
avoid to put some of the classes in several places (server, common, 
shared, WEB-INF of my apps....).
Because I had to face the well known 'NoClassDefFoundError' thrown at 
tomcat startup.

I have in my code something like :

Callback callback = getTheCallBackObject();

if(callback instanceof ApplicationCallback) {
        ((ApplicationCallback) callback).doSomething();

When I debug this part, the expression 'callback instanceof 
ApplicationCallback' is true, nevertheless if I step once, the code in the 
if block is not executed !!!

I tried to replace the test by : 

        ((ApplicationCallback) callback).doSomething();

then the code in the if block is executed but I throws a 
ClassCastException !!!

I am not sure but I think that might be related to the fact that same 
class files are located in different directories of tomcat ?.
Has anybody experienced this kind of weird behaviour?
Any suggestion to understand what is really going on is welcome!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message