eclipse HTTP 状态 404 描述 请求的资源 () 不可用。Apache Tomcat/7.0.27

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10207033/
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-09-10 21:00:24  来源:igfitidea点击:

HTTP Status 404 description The requested resource () is not available. Apache Tomcat/7.0.27

eclipsetomcat7

提问by Mohsen

when i try to access my project home at http://localhost:7080/first/or http://localhost:7080/first/start-page.htmli get this message:

当我尝试通过http://localhost:7080/first/http://localhost:7080/first/start-page.html访问我的项目主页时,我收到以下消息:

HTTP Status 404 - type Status report message description The requested resource () is not available. Apache Tomcat/7.0.27

HTTP 状态 404 - 类型 状态报告消息描述 请求的资源 () 不可用。Apache Tomcat/7.0.27

but if i ask for localhost:7080/ the home page of tomcat is correctly found.

但如果我要求 localhost:7080/ 正确找到了 tomcat 的主页。

can someone help me?

有人能帮我吗?

why i can't get my start-page.html from eclipes? but when i run from C:\Users\Mohsen\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\first\WEB-INF\start-page.html, it runs correctly.

为什么我无法从日食中获取我的 start-page.html?但是当我从 C:\Users\Mohsen\workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\first\WEB-INF\start-page.html 运行时,它运行正常。

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>first page</title>
</h:head>
<h:body>
<fieldset>
<legend>Random Results Page</legend>
<h:form>
Press button to get one of three possible results pages.
<br/>
<h:commandButton value="Go to Random Page"
/>
</h:form>
</fieldset>
…
</h:body></html>

回答by iMysak

Please look on tab "Servers" like on image: enter image description here

请查看“服务器”选项卡,如图所示: 在此处输入图片说明

If you don't see your project in server you need "publish" you project before. // right click on server -> "Add and Remove" -> add your project from "Available" into "Configured" -> click "finish" I hope this must help.

如果您没有在服务器中看到您的项目,则您需要在之前“发布”您的项目。//右键单击服务器->“添加和删除”->将您的项目从“可用”添加到“已配置”->单击“完成”我希望这对您有所帮助。

回答by ziggy

I don't think if you right click on server and select "Publish" will publish your project straight away. I think you need to add the project to the server first (I could be wrong).

我不认为如果您右键单击服务器并选择“发布”会立即发布您的项目。我认为您需要先将项目添加到服务器(我可能错了)。

Usually the easiest way to run the project on the server is to right click on the project, select "Run As" and select "Run on Server".

通常在服务器上运行项目的最简单方法是右键单击项目,选择“Run As”并选择“Run on Server”。

That will give you the option to select the server you want to use (or create a new one if you haven't created one then).

这将为您提供选择要使用的服务器的选项(如果您尚未创建,则创建一个新服务器)。

回答by Melvin Bautista

Try this move your start-page.htmlto your local host. in my case i try this code

尝试将您的移动start-page.html到本地主机。就我而言,我尝试使用此代码

sudo mv start-page.html /etc/tomcat7/Catalina/localhost

Then check your localhost if the start-page.html are there.

然后检查您的本地主机是否有 start-page.html。

Then you see the 4 .xmllike docs.xml, the examples.xml,the manager.xml, etc. and you must see the start-page.htmlthen try restart again your tomcat7.

然后就看到4.xml一样docs.xml,在examples.xml,manager.xml等,你必须去看看start-page.html然后再尝试重新启动您的tomcat7。

Because the 404 error means cannot fine the location of your start-page.html

因为 404 错误意味着无法确定您的位置 start-page.html

回答by Hasan

I think you created "xhtml file", creating a "file" and changing the file extension. This is wrong. You should create a html file and configure again extension. Then click the next button. After that, you should choose "New Facelet Template". Then finish.

我认为您创建了“xhtml 文件”,创建了一个“文件”并更改了文件扩展名。这是错误的。您应该创建一个 html 文件并再次配置扩展名。然后单击下一步按钮。之后,您应该选择“新建 Facelet 模板”。然后完成。