tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garrett Smith <>
Subject tomcat classloader bug
Date Sun, 27 Oct 2002 02:31:02 GMT

I am trying to cast a javax.mail.Session into a javax.mail.Session and I am
getting a ClassCastException. 

this code:

    Session session;
        session = (Session) envCtx.lookup(Mailer.url);
    catch(ClassCastException cce){
       throw new ClassCastException("envCtx.lookup(Mailer.url).class = "

produces this error:

java.lang.ClassCastException: envCtx.lookup(Mailer.url).class =
    at com.dhtmlkitchen.reg.mail.Mailer.sendMail(
    at com.dhtmlkitchen.reg.mail.Mailer.sendReminder(
    at com.dhtmlkitchen.reg.ChangeAccount.doPost(

Now I did some experimentation with a jsp and the object returned from the
Session pool and I fount the following statements to be true:

javax.mail.Session.class.getClassLoader == WebappClassLoader

Object obj = Mailer.envCtx.lookup( Mailer.url );

obj.getClass().getClassLoader() == StandardClassLoader 

For a detailed discussion of this, see:

JSP | Servlets | DHTML 

Garrett Needs A Job

Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message