TomConibear TomConibear - 1 month ago 9
Apache Configuration Question

CSS not found for web app using Apache Tomcat 7.0

I have a web app that I have been developing from within Eclipse IDE and have been testing using a Tomcat sever, within Eclipse. Throughout development I've had no issues with CSS files being inaccessible.

Now I'm at a point where I'm using a standalone instance of Apache Tomcat and my CSS files are simply not found? When I try to access them via their URL a 404 error is produced. The location of a CSS file within my project appears to make no difference; I have tried it in a css/ folder and in the root folder of unfiltered pages.

I don't believe this to be an issue with the link I'm referring to the files with.

CSS & Page Location

-- OpportunityTracking (unpacked .war)
-- webapps
-- login.xhtml
-- bootstrap.css


CSS Reference in login.xhtml

<link rel="stylesheet" type="text/css" href="/OpportunityTracking/bootstrap.css" />


web.xml

<display-name>OpportunityTracking</display-name>
...
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>

Answer

This project was set up as a Maven project however, the javax.faces jar was added as a dependency outside of Maven. Originally, javax.faces-2.1.26.jar was included as a referenced library in the eclipse project.

When faced with an unrelated issue, I removed this reference and included javax.faces-2.2.13.jar as a Maven dependency. In doing this, I appeared to resolve my original issue of CSS and Images not being found.