Tomcat external directory mapping

-1

I have a javaEE application where I use Tomcat 8. In it, I mapped an external folder to save the images that the user can register in one of the screens of my application. For this, I went into the server.xml file of my tomcat and did the mapping. Everything was working fine for quite some time, except that yesterday, I deleted Tomcat 8 and had to add it again. As a result, I had to redo the mapping configuration in the server.xml file.

When redoing the configuration, the mapping simply no longer works. I already gave a clear on TomCat, I already gave a clear and update project in Maven, and nothing. The context of my application is '/ Peaks' and I can access it through

localhost:8080/Picos

From there, in an attempt to redo the configuration, I went to the Tomcat server.xml and added <Context docBase="C:\Picos\images" path="/images" /> inside the <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> tag, and simply when I put in the browser the localhost:8080/Picos/images/1.png address (remembering that image 1. png exists inside the folder C: \ Peaks \ images) I get error 404.

What I'm doing wrong, since before the crash of deleting the Tomcat server in eclipise, everything was working perfectly. Am I forgetting any more configuration? Any tips? Thanks

    
asked by anonymous 24.02.2016 / 13:33

1 answer

-1

I solved the problem. I think it's fair to leave the solution here, since many may end up letting it go unnoticed. When I add a project to the tomcat server, the <Context docBase="Picos" path="/Picos" reloadable="true" source="org.eclipse.jst.jee.server:Picos"/> line is added to my server.xml. Therefore, the context path to map the external directory has to add the context path above. It would be <Context docBase="C:\Picos\images" path="/Picos/images" /> and not <Context docBase="C:\Picos\images" path="/images" />

I hope it helps =)

    
24.02.2016 / 16:25