[jboss-user] [Installation, Configuration & DEPLOYMENT] - JavaMail : java.lang.ClassCastException: javax.mail.Session

knarenderreddy do-not-reply at jboss.com
Thu May 15 07:24:46 EDT 2008


Hi

My Code is mentioned below for JavaMail in Jboss AS-4.2.2

                Context envCtx =new InitialContext();
  |              	Object obj =  envCtx.lookup("java:/Mail");
  |                 session =(javax.mail.Session)obj;

    This code for gettinh the JavaMail from Jboss As 

mail configuration is configured in mail-service.xml file 

whenever i am try to executed the above code i am getiing this below error
16:22:34,814 INFO  [STDOUT] envCtx........->javax.naming.InitialContext at 1e9093a
16:22:34,814 INFO  [STDOUT] Object........->javax.mail.Session at 5cd34e
16:22:34,814 ERROR [STDERR] java.lang.ClassCastException: javax.mail.Session
16:22:35,299 ERROR [STDERR] 	at com.gssamerica.expensereporting.ui.common.Mail.sendMail(Mail.java:62)
16:22:35,299 ERROR [STDERR] 	at com.gssamerica.expensereporting.ui.applicationadministrator.ApplicationAdminAction.saveNewAdmin(ApplicationAdminAction.java:843)
16:22:35,299 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:22:35,299 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:22:35,299 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

If anyone knows the solution please help me ...


Thanks&Regards,



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4151006#4151006

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4151006



More information about the jboss-user mailing list