javaservletswebsphere-7

404 NoTargetForURIException accessing static resources in WebContent folder under Websphere 7


In an Eclipse web project targeting WebSphere Application Server 7, I have CSS files in a css subfolder under WebContent. When I try to access them from a browser I get a 404 error saying:

Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /css

Solution

  • The solution was to enable file serving in ibm-web-ext.xml.

    1. Double-click on web.xml to open up the Web Application Deployment Description Editor.
    2. Select the "Open WebSphere Extensions Descriptor" link.
    3. Select the "Enable File Serving" checkbox and save your changes.

    This adds the following line to ibm-web-ext.xml:

    <enable-file-serving value="true"/>
    

    Acknowledgement to CodeRanch for the solution.