Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Name bound to Context

Fran´┐Żois De Grandi
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everibody !
I want to send a mail using Tomcat4.I setted the Mail Session JNDI in Tomcat console.Jndi is: mail/session , host: localhost
But When I run the Servlet,Tomcat says:"java:comp not bound to this context"
The method is according to the tomcat document.
servlet code is:"Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
Session session = (Session)envCtx.lookup("mail/session");"
Even I change the code to"Context initCtx = new InitialContext();
Session session = (Session)initCtx.lookup("mail/session");"
I also add the resource ref to web.xml and it is:
I had already set the value :
<Resource auth="Container" name="mail/session" scope="Shareable" type="javax.mail.Session"/>
<ResourceParams name="mail/session">
<value>localhost</value> // or a valid ISP smtp host :
in server.xml.
WHAT DID I MISS ? Please help...!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic