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 8152139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:37:41+00:00 2026-06-06T15:37:41+00:00

Simple question: In Tomcat7, what’s the difference between using extraResourcePaths and aliases to access

  • 0

Simple question: In Tomcat7, what’s the difference between using extraResourcePaths and aliases to access an directory outside the application?

I can use either of these two server.xml snippets and they both seem to work. Both seem to load this URL successfully: http://localhost/app/images/box.jpg. Is there an advantage to using one over the other?

<Context docBase="Eclipse_Project" path="/app"
        reloadable="true" source="org.eclipse.jst.j2ee.server:Eclipse_Project"
        aliases="/images=D:\path\to\images"/>

or

<Context docBase="Eclipse_Project" path="/app"
        reloadable="true" source="org.eclipse.jst.j2ee.server:Eclipse_Project">
        <Resources className="org.apache.naming.resources.VirtualDirContext"
                extraResourcePaths="/images=D:\path\to\images"/>
</Context>
  • 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-06T15:37:42+00:00Added an answer on June 6, 2026 at 3:37 pm

    This is the result of having multiple different ways of pulling in resources that aren’t part of a WAR or exploded directory. Frankly it is a mess long overdue a clean-up. The ‘overlay’ (or whatever it ends up being called) feature proposed for Servlet 3.1 (i.e. Tomcat 8) has prompted a major clean-up. All the current implementations will be unified into a single implementation. It isn’t pretty though, and it is going to take a while to complete.

    Aliases are treated as external to the web application resources. The DirContext checks aliases before it checks its internal resources. Hence when you request the real path you get the original.

    If you use extraResourcePaths they are treated as part of the web application resources. It looks like Eclipse has triggered a copy of application resources to the work directory. This is usually done to avoid file locking. Since the extraResourcePaths are treated as part of the webapp, they get copied too and getRealPath() reports the copied location since that is where Tomcat is serving the resources from.

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

Sidebar

Related Questions

Simple question really. Can a webapp access a config file I define and put
Simple question, but answer might be harder. I can't work out the effect on
Simple question, but I can't quite seem to figure it out: If i have
Simple question, When i use fread: fread(ArrayA, sizeof(Reg), sizeBlock, fp); My file pointer, fp
Simple question, How do I search multiple models using Sunspot?...I'm using Sunspot with Rails,
Simple question about the realloc function in C: If I use realloc to shrink
Simple question - How to list .htaccess files using glob() ?
Simple question, but one I can't find an answer to on the MSDN subscriber
Alright, this is a very simple question. I just installed Tomcat 6 on my
Simple question about regexps. I've got String text = foobar1foobar1; And I need to

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.