This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Name bound to Context Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "Name bound to Context" Watch "Name bound to Context" New topic
Author

Name bound to Context

Fran�ois De Grandi
Greenhorn

Joined: Oct 27, 2003
Posts: 4
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:
////////////////////////////////////////////////////////////////////////
<resource-ref>
<res-ref-name>mail/session</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I had already set the value :
///////////////////////////////////////////////////////////
<Resource auth="Container" name="mail/session" scope="Shareable" type="javax.mail.Session"/>
<ResourceParams name="mail/session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value> // or a valid ISP smtp host : mail.bluewin.ch
</parameter>
</ResourceParams>
in server.xml.
WHAT DID I MISS ? Please help...!
Thanks


FDG
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Name bound to Context
 
Similar Threads
javax.mail.session and DataSource(Apache Tomcat)
javax.mail.Session and DataSource (Apache Tomcat)
mail/session
How to re-config "mail.host.smtp","localhost" in tomcat 5.0.28
javax.mail.Session and DataSource (Apache Tomcat)