java WebSphere 错误 404 SRVE0295E

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26918374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 10:52:40  来源:igfitidea点击:

WebSphere error 404 SRVE0295E

javawebspherewebsphere-7

提问by FrustratedWithFormsDesigner

I've got a strange problem where an application I'm deploying to WebSphere can't seem to access its resources. I can access the main page just fine, but when index.jsp tries to reference the Javascript file it relies on, it gets a 404. Specifically, "Error 404: SRVE0295E: Error reported: 404".

我遇到了一个奇怪的问题,我正在部署到 WebSphere 的应用程序似乎无法访问其资源。我可以很好地访问主页,但是当 index.jsp 尝试引用它所依赖的 Javascript 文件时,它会得到 404。具体来说,“错误 404:SRVE0295E:错误报告:404”。

The Javascript is referenced as <script type="text/javascript" src="/contextRoot/someDir/scripts/myJavascript.js"></script>

Javascript被引用为 <script type="text/javascript" src="/contextRoot/someDir/scripts/myJavascript.js"></script>

The main entry page for the site is located at http://localhost:9080/contextRoot/index.jspand it loads fine.

该站点的主入口页面位于http://localhost:9080/contextRoot/index.jsp并且可以正常加载。

If I try to navigate my browser to http://localhost:9080/contextRoot/someDir/scripts/myJavascript.jsI get Error 404: SRVE0295E, even though the path to the file in my WebSphere installed application $myCell/myApp.ear/myWARModule.war/index.jspand $myCell/myApp.ear/myWARModule.war/someDir/scripts/myJavascript.jsare both valid, the only resource I can access from a browser is index.jsp.

如果我尝试浏览我的浏览器http://localhost:9080/contextRoot/someDir/scripts/myJavascript.js我得到Error 404: SRVE0295E,即使路径在我的WebSphere文件安装的应用程序$myCell/myApp.ear/myWARModule.war/index.jsp$myCell/myApp.ear/myWARModule.war/someDir/scripts/myJavascript.js都是有效的,唯一的资源,我可以从浏览器访问的index.jsp

Does anyone know what could cause this error?

有谁知道什么可能导致这个错误?

(Running on WebSphere 7.0.0.29)

(在 WebSphere 7.0.0.29 上运行)

回答by Gas

To serve static files like images, html, or javascript application needs to have file serving enabled. You can do it by editing ibm-web-ext.xmlfile in the WEB-INFfolder, and ensuring that enable-file-servingis set to true.

要提供图像、html 或 javascript 等静态文件,应用程序需要启用文件服务。您可以通过编辑ibm-web-ext.xml文件WEB-INF夹中的文件并确保将enable-file-serving其设置为true.