简体   繁体   English

尝试在Eclipse中运行JSP文件时的HTTP 404

[英]HTTP 404 when trying to run a jsp file in eclipse

I get 404 error when trying to run a jsp file eclipse. 尝试运行JSP文件蚀时出现404错误。 The confusing thing is the server is running and I can go to localhost:8080 without any problems. 令人困惑的是服务器正在运行,我可以毫无问题地转到localhost:8080 I have attached an image of my configuration of server, the jsp file and also the location of the file and the error. 我已附上服务器配置,jsp文件以及文件位置和错误的图像。

在此处输入图片说明

I embed the image cause of the reputation thing so I have linked it 我嵌入了声誉事件的图像原因,因此已将其链接

More information: 更多信息:

I am using TOMCAT 7, ECLIPSE KEPLER I have checked the location of helloworld.jsp its in WebContent. 我正在使用TOMCAT 7,ECLIPSE KEPLER,我已经检查了helloworld.jsp在WebContent中的位置。 I have restarted the server. 我已经重新启动服务器。 I have created another dynamic web project nothing works. 我创建了另一个动态Web项目,但是没有任何效果。 I get the same problem I can go to localhost:8080 but I cant run an JSP file 我遇到相同的问题,我可以转到localhost:8080但是无法运行JSP文件

SOLVED: 解决了:

Okay guys its pretty simple to solve this problem. 好的,解决这个问题非常简单。 There are two things you need to try. 您需要尝试两件事。

1)Right click your project and export the war file into C:\\ProgramFiles\\Tomcat7 folder If this does not work then. 1)右键单击您的项目,然后将war文件导出到C:\\ProgramFiles\\Tomcat7文件夹中。

2) Right click your project and export the war file into some directory and copy the war file into C:\\ProgramFiles\\Tomcat7 then start the Tomcat server and there you go your JSP file work. 2)右键单击您的项目,然后将war文件导出到某个目录,并将war文件复制到C:\\ProgramFiles\\Tomcat7然后启动Tomcat服务器,然后在其中运行JSP文件。

You will probably end up doing step 2 because of stupid windows file permissions 由于愚蠢的Windows文件权限,您可能最终将执行步骤2

Also thanks for all the help guys really appreciate it. 也感谢所有帮助人员非常感激它。

确保您已将Jsp文件放入WebRoot中,并检查位置,甚至检查Web.xml,然后在运行后仍然无法正常运行,然后在此处发布Web.xml。

Unfortunately, user3135774's solution does not work for me, as am using an Apple computer. 不幸的是,user3135774的解决方案不适用于我,就像使用Apple计算机一样。

I have read and researched another problem (Error 500: No Output Folder), which I have along with Error 404, carefully, and I think this is related to permission issues. 我已经仔细阅读并研究了另一个问题 (错误500:无输出文件夹),该问题与错误404一起出现,我认为这与权限问题有关。

The JSP file is supposed to be compiled and then deployed under Tomcat/work/Catalina/localhost/YourProjectName . 应该编译JSP文件,然后将其部署在Tomcat/work/Catalina/localhost/YourProjectName The 404 error message means that there is no files in that directory. 404错误消息表示该目录中没有文件。 Since Eclipse has no write permission to this directory, you have to change the access permissions. 由于Eclipse没有对此目录的写许可权,因此您必须更改访问许可权。 After changing the permission to 777 , there we have the compiled .java and .class files. 将权限更改为777 ,便有了已编译的.java和.class文件。

Since you do not have any of them 由于您没有任何人

index.html/index.htm/index.jsp/default.html/default.htm/default.jsp page

To run your jsp page : 要运行您的jsp页面:

In Eclipse: 在Eclipse中:

=>goto Java Resource =>转到Java资源

=>right click on your jsp page =>右键单击您的jsp页面

=>in that select Run as Server. =>在那选择运行为服务器。

After applying everythings, it did not work for me to read image file in eclips. 应用所有内容后,对我来说,在Eclipse中读取图像文件不起作用。

Finally, It works! 最后,它起作用了! after that I change deploy path. 之后,我更改部署路径。

Server Locations>Deploy path(Set with "Workspace" of Eclipse) 服务器位置>部署路径(使用Eclipse的“工作区”设置)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM