Serving static content through Tomcat 7
-
I have a spring application served through Tomcat 7. this application has a desktop counterpart.
i didn't want to include the desktop binaries inside the war, so i asked google how to serve static content.google said: add this to your
server.xml
:<Host appBase="webapps"> ... <Context docBase="/home/static/web" path="/static" /> </Host>
with a matching user and sftp access to update the binaries alone.
well, that setup worked well until today. tomcat is giving me 404 errors on files i know the server has.
and i have no fracking idea where to start looking.
i've checked the logs, and they don't show anything...so, to resume.
how do you troubleshoot tomcat?
creating a new context is the way to go?
-
creating a new context is the way to go?
maybe restart the context? I've only got limited experience with Tomcat.
-
tried that, Context and Tomcat itself, nothing changed =/
-
i know the server has.
Are you sure someone didn't delete them?
Follow-up: Are you sure you're looking at the right server?
-
100%.
there's only one server with this app, and only four people with access to it.UPDATE: it's serving some files, it's almost like if it was serving cached copies of the files ....
-
Googling stuff like "tomcat 404 static content" provided some links that looked like they might be helpful, but I don't know if they'd apply to your situation.
-
Apologies for the basic question, but does the account that tomcat is running under have read access to the files in question?
-
meh, if we start skipping the obvious we can easily overlook something important.
but no, the permissions are fine, that kind of things have bitten me enough to check it out always.it's almost like if it was serving cached copies
this.
find / -name "fileThatWorks.exe"
and found a copy of the original static folder in/var/lib/tomcat7/webapps
as it turns out, when i first created the static context it created a copy of the folder...
i don't even know how i did this, blame my lack of experience with tomcatanyway, the solution(for now):
ln -s /home/static/web/ static
it works, and gives me time to look for the right answer...
anyone with tomcat experience wants to yell at me for that?
-
When you put a war file in the webroot, it will unpack it automatically into a subdirectory. Maybe something like this is going on?
-
it looks like that. right now, the softlink seems to be working right. we'll see if it breaks something...