is the Session object loaded by 'Mailer.envCtx.lookup()' loaded in the same classloader?
do you have a different version of javamail in your WEB-INF/lib that is passed to a class in /common/lib where the version shipped with tomcat is loaded? Charlie > -----Original Message----- > From: Garrett Smith [mailto:javadevmac2@;yahoo.com] > Sent: Sunday, October 27, 2002 8:53 AM > To: Tomcat Users List > Subject: Re: tomcat classloader bug > > > javax.mail.Session obj = > (javax.mail.Session)Mailer.envCtx.lookup( Mailer.url > ); > > > --- [EMAIL PROTECTED] wrote: > > did you import the right Session class? > > On Sunday, October 27, 2002, at 02:31 AM, Garrett Smith wrote: > > > > > 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> > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> > > For additional commands, e-mail: > <mailto:tomcat-user-help@;jakarta.apache.org> > > > > > ===== > 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> > -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>