Ok I'm having some problems getting this value from my app.. here's what I have put into my server.xml: <GlobalNamingResources> <Environment name="mailServer" type="java.lang.String" value="192.168.0.23"/> <Environment name="mailUser" type="java.lang.String" value="[EMAIL PROTECTED]"/> </GlobalNamingResources>
according to the docs: name: The name of the environment entry to be created, relative to the java:comp/env context. from my servlet I try getting that using: InitialContext ctx = new InitialContext(); String mailServer = (String)ctx.lookup("java:comp/env/mailServer"); String mailUser = (String)ctx.lookup("java:comp/env/mailUser"); however this throws an exception: javax.naming.NameNotFoundException: Name mailServer is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) Any Ideas? I also tried setting it in server.xml to be "mail/mailServer" then looking it up as "java:comp/env/mail/mailServer" but it through the same exception saying Name mail is not bound in this Context. Thanks in advance, David ----- Original Message ----- From: "Shapira, Yoav" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Wednesday, December 24, 2003 1:05 PM Subject: RE: getting Server.XML properties in servlets? Howdy, You can use env-entry-ref for this (read the servlet specification on this web.xml property and tomcat's JNDI How-To document for the server.xml <Environment> element). Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: David Erickson [mailto:[EMAIL PROTECTED] >Sent: Wednesday, December 24, 2003 2:58 PM >To: Tomcat-User List >Subject: getting Server.XML properties in servlets? > >Hi I am working on an app that relies on an address to a mail server.. and >the mail server's address is different inside our network due to proxy >stuff >than it is from outside, and our app will be deployed in both places. Is >it >possible for me to set some kind of property inside my server.xml file then >from within my servlet be able to get that property? > >thanks! >-David > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]