在面向 WebSphere Application Server 7 的 Eclipse Web 项目中,WebContent 下的 css 子文件夹中有 CSS 文件。当我尝试从浏览器访问它们时,我收到 404 错误:
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /css
最佳答案
解决方案是在 ibm-web-ext.xml 中启用文件服务。
- 双击 web.xml 打开 Web 应用程序部署 描述编辑器。
- 选择“打开 WebSphere 扩展 描述符”链接。
- 选中“启用文件服务”复选框并保存 您的更改。
这会将以下行添加到 ibm-web-ext.xml:
<enable-file-serving value="true"/>
感谢 CodeRanch 提供的解决方案。
关于java - 404 NoTargetForURIException 访问 Websphere 7 下的 WebContent 文件夹中的静态资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19882354/