Posted By:
beula_sc
Posted On:
Wednesday, April 11, 2001 04:05 AM
I deployed mail bean,i made some changes in "weblogic.properties" like weblogic.httpd.MailSession.testBean= mail.from=myname@mycompany.com, mail.host=mailserver part of the program is as follows: Properties h = new Properties(); Message pmsMsg=null; try{ h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); h.put(Context.PROVIDER_URL, "t3://localhost:7001"); InitialContext ic = new InitialContext(h); Session session = (Session)ic.lookup("testBean"); Properties props = new Properties(); props.put("mail.tr
More>>
I deployed mail bean,i made some
changes in "weblogic.properties"
like
weblogic.httpd.MailSession.testBean=
mail.from=myname@mycompany.com,
mail.host=mailserver
part of the program is as follows:
Properties h = new Properties();
Message pmsMsg=null;
try{
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
InitialContext ic = new InitialContext(h);
Session session = (Session)ic.lookup("testBean");
Properties props = new Properties();
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.host", "myserver");
props.put("mail.from", "myname@mycompany.com");
Session session2 = session.getInstance(props);
pmsMsg = new MimeMessage(session2);
}catch(Exception ess)
{
System.out.println("Exception in context: "+ess);
}
Exceptionis:
java.lang.ClassCastException: occuring in the place of
"Session session = (Session)ic.lookup("testBean");"
if anyone has come across this please help me
<<Less