我正在使用Ubuntu上的IntelliJ Ultimate Edition中的Web应用程序。我收到错误的状态:源服务器没有找到目标资源的当前表示,或者不愿意透露存在该目标资源。
我最初做的是我去了File>新项目>选定的JavaEE - Web应用程序。默认情况下,在web.xml中,该文件具有最少的代码,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
我对该文件进行了一些修改,并添加了以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<display-name>Module8</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
这样做后,我在web文件夹下创建了一个index.html文件,并添加了以下代码来测试tomcat是否正常运行(非常基本的html代码)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Module 8</title>
</head>
<body>
<h3>Welcome to My login interface!</h3><br/>
Please <a href = "login.html">Click Here to Login</a>
</body>
</html>
每次我在服务器上部署项目并尝试从IntelliJ中运行它时,都会收到404错误消息,其原因如下:
原始服务器未找到目标资源的当前表示,或者不愿意透露该目标资源是否存在。
我使用此视频作为在IntelliJ中设置Tomcat的参考:
https://www.youtube.com/watch?v=4Zp5suN1b1E&
我现在被困住了。整个周末,我试图让Tomcat无法正常运行,我觉得好像我每天花费数小时进行尝试让Tomcat正常运行而不编写任何实际代码。至少可以说这有点令人沮丧。