The moose likes Servlets and the fly likes How to configure context.xml in tomcat/config Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

How to configure context.xml in tomcat/config

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
I am using Tomcat 5.5.9

To get this code working in servlet for cross-context communication

ServletContext currentContext = getServletContext();
ServletContext futureContext = currentContext.getContext("/TestOne");

am supposed to make certain configuration changes in tomcat

And this is what I did in context.xml

<Context path="/SessionExample" docBase="E:\tomcat\webapps\SessionExample"
crossContext="true" debug="0" reloadable="true" privileged="true">

<Context path="/TestOne" docBase="E:\tomcat\webapps\TestOne"
crossContext="true" debug="0" reloadable="true" privileged="true">

where SessionExample is current context and TestOne is my second context.

But I am getting error when I startup tomcat server.

SEVERE: Parse error in default web.xml
org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Duplicate of:

The Tomcat forum was the right place for this question.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: How to configure context.xml in tomcat/config
It's not a secret anymore!