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

  • SEARCH
  • Home
  • 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 7581107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:07:06+00:00 2026-05-30T18:07:06+00:00

I have a web application with a following structure: src + main +-+ java

  • 0

I have a web application with a following structure:

src
+ main
+-+ java
  + resources
  + webapp
  +-+ WEB-INF
    + static

The static directory is server by org.apache.catalina.servlets.DefaultServlet, otherwise it is served by the application. What I am trying to achieve, is to access the static directory from the application. However, once it is deployed on the server, the directory seems to be “lost” – I can’t access it neither in relative path (by new File()) nor in classpath (by new ClassPathResource()). I could see, that the directory is missing in the target dir, which is probably correct, but I don’t know what I can do about it.

Thanks.

Edit

  1. Maybe it is not clear, but directory static is a sibling of WEB-INF and not its child.
  2. The static directory might contain 2 GB of images. So it is not desired that this directory should be copied every time the application is deployed (so putting it in the classpath is not probably a good idea).
  3. I just can’t find the behaviour of DefaultServlet, which I allow to access this directory. Does it copy all the stuff somewhere else? Or does it access it as by absolute path?
  • 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-05-30T18:07:07+00:00Added an answer on May 30, 2026 at 6:07 pm

    I’m pretty sure WEB-INF isn’t visible to the classpath, you’d have to put it in the webapp folder. Better yet, you probably want to look into using an mvc:resources tag.

    http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html

    Search mvc:resources for an explaination.

    EDIT

    If you place the resource in src/main/resources, they should be available to a ClassPathResource

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

Sidebar

Related Questions

I have the following structure in a Java Web Application: TheProject -- [Web Pages]
I have following structure of web application, for which I'm automating testing: <em unselectable=on
I have an .Net MVC 3 web application that has the following structure root
I have a web application with the following structure: TOMCAT_HOME | webapps |_myapp |-html/
I have a EAR application with following structure: app.ear |-- app.war `-- META-INF `--
I have a Spring MVC based Web Application with Hibernate. Following is the directory
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
I have a web application that comprises the following: A web project (with a
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have an ASP.NET web application which does the following: Reads an Excel file.

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.