user1430003
user1430003

Reputation: 29

Tomcat Configure To Serve Static Files is not working

I have linux machine, on which I have deployed my project. I have some static content which I have placed at /var/grt_dynamic_images on physical harddisk on linux. I am using it as /EchlonSurvey/images/dynamic/images. It is working fine on windows but not on linux.

Here is the server.xml file snapshot, where I am doing this configuration.

<Context docBase="/var/grt_dynamic_images" path="/EchelonSurvey/images/dynamic_images" />
        <Context docBase="/var/grt_dynamic_images/category_images" path="/EchelonSurvey/images/dynamic_images/cat_images" />
        <Context docBase="/var/grt_dynamic_images/profile_images" path="/EchelonSurvey/images/dynamic_images/prof_images" />

In webpage, I get 404 error. The path is same but the image are not coming from docBase. I have checked, there are all image which I need.

http://.../EchelonSurvey/images/dynamic_images/cat_images/277152_9449%20sml.png image not available

Upvotes: 1

Views: 1072

Answers (1)

emilebaizel
emilebaizel

Reputation: 4695

one suggestion. if you have a ROOT webapp, you can create a symbolic link within it and point to the folder you want to serve. so something like

/tomcat/webapps/ROOT:  ln -s /var/grt_dynamic_images /EchelonSurvey/images/dynamic_images

when i do this, it 'works' but only if i am specifying an actual resource on the url, like a .png file. i still get 404's if i just stop the url at a folder level. i'm sure there's some Tomcat setting for displaying a folder listing but haven't looked into it.

Upvotes: 1

Related Questions