Hi! Phillip, Thanks for the help.
My questions are: 1. in web.xml My context definition is: <servlet-mapping> <servlet-name>UpdateItemServlet</servlet-name> <url-pattern>/servlet/chapter6</url-pattern> </servlet-mapping> It works fine 2. I have a context file called javaxml2.xml, in this file: I defined: <Context path="/servlet/chapter6" docBase="javaxml2" debug="0" reloadable="true" crossContext="false"> ... </Context> 3. where should this context file reside? My war file name is javaxml2.war. 4. My practice app probably didn't read this javaxml2 context file!!! Because I have a test env variable also didn't get read: <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/> <ResourceParams name="mail/Session"> <parameter> <name>mail.smtp.host</name> <value>ismtp.irf.com</value> </parameter> </ResourceParams> <Environment name="david" value="10" type="java.lang.Integer" override="false"/> 5. error message from catalina: INFO: Jk running ID=0 time=0/31 config=C:\jakarta-tomcat-5.0.29\conf\jk2.proper ties Oct 25, 2004 1:57:36 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 5467 ms javax.naming.NameNotFoundException: Name david is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:768) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at javaxml2.UpdateItemServlet.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:157) Thanks a million David -----Original Message----- From: Phillip Qin [mailto:[EMAIL PROTECTED] Sent: Monday, October 25, 2004 1:36 PM To: 'Tomcat Users List' Subject: RE: Why mail/session always being set to localhost even Context.x ml says otherwise? Add use plain email address, e.g. [EMAIL PROTECTED] -----Original Message----- From: Phillip Qin [mailto:[EMAIL PROTECTED] Sent: October 25, 2004 4:34 PM To: 'Tomcat Users List' Subject: RE: Why mail/session always being set to localhost even Context.x ml says otherwise? Assume your Resource is closed by </Resource>. Try addRecipient. -----Original Message----- From: David Lee [mailto:[EMAIL PROTECTED] Sent: October 25, 2004 4:26 PM To: [EMAIL PROTECTED] Subject: RE: Why mail/session always being set to localhost even Context.xml says otherwise? My contents for mail/Session in web.xml: <resource-ref> <description> Resource reference to a factory for javax.mail.Session instances that may be used for sending electronic mail messages, preconfigured to connect to the appropriate SMTP server. </description> <res-ref-name> mail/Session </res-ref-name> <res-type> javax.mail.Session </res-type> <res-auth> Container </res-auth> </resource-ref> Thanks for the help! David Lee -----Original Message----- From: Phillip Qin [mailto:[EMAIL PROTECTED] Sent: Monday, October 25, 2004 1:21 PM To: 'Tomcat Users List' Subject: RE: Why mail/session always being set to localhost even Context.xml says otherwise? What is in your web.xml? -----Original Message----- From: David Lee [mailto:[EMAIL PROTECTED] Sent: October 25, 2004 3:51 PM To: [EMAIL PROTECTED] Subject: Why mail/session always being set to localhost even Context.xml says otherwise? Tomcat: 5.0.29 OS: XP JAVA: 1.5.0 Context.xml: jakarta-tomcat-5.0.29\conf\Catalina\localhost <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/> <ResourceParams name="mail/Session"> <parameter> <name>mail.smtp.host</name> <value>company email server</value> </parameter> </ResourceParams> Java program: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); Session session = (Session) envCtx.lookup("mail/Session"); Message message = new MimeMessage(session); message.setFrom(new InternetAddress("from email <mailto:[EMAIL PROTECTED]> ")); InternetAddress to[] = new InternetAddress[1]; to[0] = new InternetAddress("to email <mailto:[EMAIL PROTECTED]> "); message.setRecipients(Message.RecipientType.TO, to); message.setSubject("test mail session from tomcat"); message.setContent("test mail session from tomcat", "text/plain"); Transport.send(message); Catalina ERROR: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: localhost , port: 25; nested exception is: java.net.ConnectException: Connection refused: connect at javax.mail.Transport.send0(Transport.java:204) at javax.mail.Transport.send(Transport.java:73) at javaxml2.UpdateItemServlet.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:157) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !DSPAM:417d6356217529789243331! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]