• Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.mail.Session and DataSource (Apache Tomcat)  RSS feed

 
Sergey Kargopolov
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day!

I am very sorry for cross posting but I have just noticed that this section also disscusses JavaMail and decided to post. Please forgive me I am violating forum rules.

I am trying to set up DataSource to use javax.mail.session. And I need help here.

1. I think I configured web.xml correctly.

<resource-ref>
<res-ref-name>mail/MailSession</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

2. How to lookup JNDI is also clear I think

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (javax.mail.Session) envCtx.lookup("mail/MailSession");

3. But I am not sure how to configure server.xml(TOMCAT)

<Resource name="mail/MailSession" auth="Container" ype="javax.mail.Session" mail.smtp.host="sergey"/>

Is it correct way to configure?

Please suggest me where can I go and read more information about java.mail.session with DataSource, may be see some examples, tutorials.


Thank you very much!
 
Sergey Kargopolov
Ranch Hand
Posts: 63
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!