Hello everybody.

I am trying to get a mail session using the context's lookup method and I 
get a ClassCastException.

this is the resource declaration in my context.xml:

<Resource name="mail/sessionMail" auth="Container" type="javax.mail.Session" 
mail.smtp.host="localhost"/>

the code I am using to lookup the resource is:

Context initialContext = new InitialContext();
Object objeto = initialContext.lookup("java:comp/env/mail/sessionMail");
String clase = objeto.getClass().getName();
if(objeto instanceof javax.mail.Session)
{
this.session = (javax.mail.Session) objeto;
}

when I debug that code I see the "clase" variable has "javax.mail.Session" 
as value but the if test does not pass

Can anybody help men??

thanks

-- 
------------------------------------------------------------------
Carlos J, Bracho M. 
------------------------------------------------------------------
e-mail: [EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]
+58 416 409 21 75 
------------------------------------------------------------------

Reply via email to