I need to map an directory containing images which resides outside tomcat webapps folder, so that application can serve those images.
I am making a J2EE Web applicat
I had the same issue but found a solution.
If you are using Eclipse and a Tomcat plugin then please note that the Eclipse Tomcat plugin creates a separate CATALINA_BASE
under the Eclipse workspace
directory.
You can go to this location and you will find server.xml
.
Use that server.xml
and it will work.
My actual tomcat directory is:
C:\apache-tomcat-7.0.62x64\apache-tomcat-7.0.62\conf
and my Eclipse Tomcat server uses:
C:\workspace\JSF\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf
Use the workspace path and server.xml
from this location.
Add this in server.xml
inside the host tag:
< Context docBase="D:/personal" path="/images" />
and it will work if D:/personal
has 1.png
, and then the url http://localhost:8080/images/1.png
will load the image.