Hey, I am trying to cast a javax.mail.Session into a javax.mail.Session and I am getting a ClassCastException.
this code: Session session; try{ session = (Session) envCtx.lookup(Mailer.url); } catch(ClassCastException cce){ throw new ClassCastException("envCtx.lookup(Mailer.url).class = " +envCtx.lookup(Mailer.url).getClass().getName()); } produces this error: java.lang.ClassCastException: envCtx.lookup(Mailer.url).class = javax.mail.Session at com.dhtmlkitchen.reg.mail.Mailer.sendMail(Mailer.java:110) at com.dhtmlkitchen.reg.mail.Mailer.sendReminder(Mailer.java:72) at com.dhtmlkitchen.reg.ChangeAccount.doPost(ChangeAccount.java:68) 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: http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=003627 ===== http://dhtmlkitchen.com/ JSP | Servlets | DHTML Garrett Needs A Job __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/ -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>