| 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
|
 |
 |
|
|
subject: Name bound to Context
|
|
|