Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9280431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:52:10+00:00 2026-06-18T17:52:10+00:00

I am trying to override a parameter in my application’s web.xml file by creating

  • 0

I am trying to override a parameter in my application’s web.xml file by creating a context.xml file in <tomcatHome>/conf/Catalina/localhost

The context.xml file looks like

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/myapp">    
    <Parameter name="port" value="100" override="1"/>
</Context>

but I get an error saying

java.lang.IllegalArgumentException: Document base <path-to-tomcat> apache-tomcat-7.0.35/webapps/context does not exist or is not a readable directory

If I put the <Parameter name="port" value="100" override="1"/> directly in the context.xml in <tomcat-home>/context.xml then it works.

Can someon explain what I am doing incorrectly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T17:52:12+00:00Added an answer on June 18, 2026 at 5:52 pm

    It is because there is no such application context with the name context. In other words there is no web app with the name context deployed to the webapps directory.

    Form the official Tomcat 7 documentation related to Defining a context:

    Individual Context elements may be explicitly defined:

    • In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host’s copyXML attribute)
      this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and
      renamed to application’s base file name plus a “.xml” extension.

    • In individual files (with a “.xml” extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context
      path and version will be derived from the base name of the file (the
      file name less the .xml extension)
      . This file will always take
      precedence over any context.xml file packaged in the web application’s
      META-INF directory.

    • Inside a Host element in the main conf/server.xml.

    So to make it work, name your custom file not context.xml, but your_app_name.xml.
    In your case it will be (if I understood you correctly) myapp.xml.

    This should work. I have just tested it.

    myapp.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <Context>    
        <Parameter name="port" value="100" override="1"/>
    </Context>
    

    P.S.

    And you can get without path attribute, so don’t include it.
    From the Apache Tomcat 7 documentation:

    This attribute must only be used when statically defining a Context in
    server.xml
    . In all other circumstances, the path will be inferred from
    the filenames used for either the .xml context file or the docBase.

    Even when statically defining a Context in server.xml, this attribute
    must not be set unless either the docBase is not located under the
    Host’s appBase or both deployOnStartup and autoDeploy are false
    . If
    this rule is not followed, double deployment is likely to result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to override the file login.xml but no matter what I try,
I'm trying to change the layout of my application according to a GET parameter
I have a Struts2 (version 2.2.3) web application. I am trying to redirect old
I am creating an image processing application in C# and trying to take advantage
Trying to override a tostring in one of my classes. return string.Format(@ name =
im trying to override the add() but it will not compile public class AVLTree<E
I'm trying to override a JSP in Liferay 6.1, namely html/portlet/enterprise_admin/settings/authentication.jsp. I have created
I'm trying to override a method inside a jquery widget. The method can be
If I am trying to override a specific tag inside multiple classes, do I
I'm trying to override the window.confirm in ExtJS 4. The override should return either

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.