You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by R Ravichandran <ra...@gmail.com> on 2009/06/02 03:54:46 UTC
Replacing the default ROOT application
Hello,
I would like to deploy a Spring MVC application that I developed as the ROOT
application on Tomcat. I also configured the Tomcat server to run on port
80. My Spring application has JNDI references to Java mail sessions. I am
unable to figure out how to get this configured. Here is what I did:
_ In the server.xml file, I created a special <Context> element under the
<Host> element. I added a <Resource> element for the mail server inside
this.
<Context path="/ROOT" docBase="ROOT" debug="5" reloadable="true"
crossContext="true">
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session" mail.smtp.host="localhost"/>
</Context>
But I get this following error message when the application starts:
Jun 1, 2009 6:34:53 PM org.springframework.web.context.ContextLoader
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'mailSession' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested
exception is javax.naming.NameNotFoundException: Name mail is not bound in
this Context
Any suggestions on how to attach JNDI resources for Default web application
for Tomcat.
Thanks.
RE: Replacing the default ROOT application
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: R Ravichandran [mailto:ravirajamiyer@gmail.com]
> Subject: Replacing the default ROOT application
> _ In the server.xml file, I created a special <Context>
> element under the <Host> element.
Assuming you're using a current version of Tomcat (you didn't bother to tell us), you should not be placing <Context> elements in server.xml - remove it. The <Context> element belongs in the webapp's META-INF/context.xml file.
> <Context path="/ROOT" docBase="ROOT" debug="5" reloadable="true"
Do not use path or docBase attributes when you put the <Context> element in the proper place. (Your path attribute was incorrect anyway.)
> But I get this following error message when the application starts:
Did you follow the doc for JNDI access to mail?
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JavaMail%20Sessions
There's more to be done than just setting up the <Resource> element.
Read the doc, remove the <Context> element from server.xml, put a proper one in webapps/ROOT/META-INF/context.xml, correct your WEB-INF/web.xml per the doc, and try again.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org