Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem facing with send email program

 
Chandraprabha Rajput
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All.

I want to send email to people if program fails.

to do this i have set JBOSS mail-service.xml
and the send my email program is :


while running getting an exception : can not cast javax.mail.session to javax.mail.session at mailSession = (Session) ictx.lookup("java:/Mail");

Kindly help me

Thanks,
Chandra
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, please use the code tag for source listing - makes them much easier to read. I edited your post for you this time...

Second, what JAR files are you packaging with your app? I suspect that you have mail.jar file in your app. If so, remove it.
 
Chandraprabha Rajput
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for formating and reply.


I have checked my app build but it does not have mail .jar file.




 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the -verbose:class option to JAVA_OPTS within run.bat (or run.comf on Linux). This option prints out each class loaded and the JAR file it came from. This should help you located the addition JAR file containing javax.mail.Session.
 
Chandraprabha Rajput
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for help.

I could find that javax.mail.Session class is getting loaded twice.

It gets loaded by pom file. Could you please tell me how i can find from which pom.xml it is getting loaded.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are going to have to tell us a little bit more about your application and how you are running it because I am surprised that pom.xml is even involved.

Also, how did you determine that it is because of the pom? Exactly what output did you get from -verbose:class for the two instances of the javax.mail.Session class that were loaded?
 
Chandraprabha Rajput
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could find out from which pom file, it was loading the extra jar file.

Thanks a lot for help it realy saved my day .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic