java.lang.ClassCastException when trying to send mail using weblogic(EntityBean)
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   charanjay_sc
Posted On:   Wednesday, April 11, 2001 04:05 AM

To deploy mail bean in weblogic I made some  changes in "weblogic.properties" as 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");     Properti   More>>

To deploy mail bean in weblogic I made some 

changes in "weblogic.properties" as



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);

}



Exception is:



java.lang.ClassCastException: occuring in the place of 

"Session session = (Session)ic.lookup("testBean");"



if anyone has come across this please help me

   <<Less
About | Sitemap | Contact