Posted By:
Garrett_Smith
Posted On:
Friday, October 25, 2002 11:49 AM
Hey, I posted this on JNDI forum, but it may be a JavaMail question or even a general Java question. I'm perplexed by this. How can 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()); } Produce 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)
More>>
Hey, I posted this on JNDI forum, but it may be a JavaMail question or even a general Java question. I'm perplexed by this.
How can 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());
}
Produce 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)
?
It happens every time. How and why?
<<Less