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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:23:35+00:00 2026-06-17T09:23:35+00:00

I have a simple servlet for images uploading, a user select an image and

  • 0

I have a simple servlet for images uploading, a user select an image and the servlet does its job and then write it to upload directory. My project layout:

project
    ├───static
    │   ├───img
    │   └───js
    ├───upload
    └───WEB-INF
        └───lib

After uploading the image, the user is redirected to it’s location:

http://localhost:8080/upload/[image MD5 hash].png

The uploading code works pretty well, but Tomcat returns 404 error when requesting the url even when the image is there:

> wget http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\GnuWin32/etc/wgetrc
--2013-01-16 03:45:33--  http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-01-16 03:45:33 ERROR 404: Not Found.
> 

After I click update classes and resources in my IDE, Intellij, it works:

> wget http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\GnuWin32/etc/wgetrc
--2013-01-16 03:48:11--  http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11666 (11K) [image/png]
Saving to: `f5d1da2cadf3bd1c1b9196ec522a5d73.png'

100%[==========================================================>] 11,666      --.-K/s   in 0s

2013-01-16 03:48:11 (72.9 MB/s) - `f5d1da2cadf3bd1c1b9196ec522a5d73.png' saved [11666/11666]
>

The second thing is that when I manualy delete this image, I still can download it (does Tomcat do some sort of cashing?):

> del f5d1da2cadf3bd1c1b9196ec522a5d73.png
> wget http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\GnuWin32/etc/wgetrc
--2013-01-16 04:12:25--  http://localhost:8080/upload/f5d1da2cadf3bd1c1b9196ec522a5d73.png
Resolving localhost... 127.0.0.1, ::1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11666 (11K) [image/png]
Saving to: `f5d1da2cadf3bd1c1b9196ec522a5d73.png'

100%[==========================================================>] 11,666      --.-K/s   in 0s

2013-01-16 04:12:25 (93.2 MB/s) - `f5d1da2cadf3bd1c1b9196ec522a5d73.png' saved [11666/11666]
> 

My web.xml file:

<servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>/static/*</url-pattern>
    <url-pattern>/upload/*</url-pattern>
</servlet-mapping>

Could someone please tell me where is the problem?

  • 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-17T09:23:36+00:00Added an answer on June 17, 2026 at 9:23 am

    when deploy in development your resouce will deploy in development resource not workspace ,and when you remove in workspace must redeploy for change in development resource

    sory in my english,

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

Sidebar

Related Questions

I have a simple image servlet to serve up images that I am storing
I have a simple servlet where I write to a file if it has
I have a simple servlet say com.test.HelloWorld.class then I create these folders tree: WEB-INF
I have simple jsf app with servlet for dynamic images and filter setting utf8
I have a simple jsp/servlet application and I want to add AJAX feature to
I have a simple (Servlet, JSP, and JSTL) web app whose main functionality is
I have a simple WAR project managed by Maven. I have the servlet code
I have a simple servlet at the moment. I need it to call a
Okay so I have a simple servlet like this. public class SimpleServlet extends HttpServlet
Let's say I have a simple Login servlet that checks the passed name and

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.