You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rene Dietze <re...@sports-and-bytes.de> on 2002/01/22 13:56:54 UTC

ClassCastException only in tomcat4

Hello..

I have a problem with tomcat 4.
My servlet application run's fine under jserv and tomcat 3.3
under tomcat4 receive a java.lang.ClassCastException

deep in my startup process.. load classes with the classLoader..

try
{
  System.out.println("loadClass:"+clazz);
  Object o = Thread.currentThread().getContextClassLoader().loadClass(clazz).newInstance();
  System.out.println("Instance:"+o.toString());
  de.SB.parser.hook.Section  s = (de.SB.parser.hook.Section)o;
}
catch(Exception e)
{
  System.out.println(e.toString());
}

Here my STDOUT:      
 loadClass:de.SB..parser.hook.Section
 Instance:de.SB.parser.hook.Section@62cb55
 java.lang.ClassCastException: de.SB.parser.hook.Section 


a simple TypeCast..

I use under all versions (jserv,tomcat3.3,tomcat4)
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

Linux Kernal 2.4.10


I attempted also that:
ClassLoader.getSystemClassLoader().loadClass(clazz).newInstance();
but the instance of Section is really ok


I hope yours can help me

rene


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>