404 NoTargetForURIException accessing static resources in WebContent folder under Websphere 7

StackOverflow https://stackoverflow.com/questions/19882354

  •  30-07-2022
  •  | 
  •  

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
有帮助吗?

解决方案

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.

其他提示

Another way to get this error is if your path name after the host is wrong. For example if you are deploying an EAR, and try to hit the name of the EAR. You have to make sure make sure the path matches the web application name exactly.

enter image description here

Make sure the context root is correct.

One can do this in the WebSphere Application Server administration console. Check IBM's Resolving the problem.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top