简体   繁体   中英

404 error, server not found when using right click on index.html then Run

I am having issue with my Tomcat Server in IntelliJ. My program will run when Tomcat is selected in the configurations on the top right of the program. For some reason my professor wants us to be able to right click on the index.html page and select run. When I do it that way I get a 404 error:

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

I am not sure what is wrong with my set up. I transfered my program to my friends configuration and it had the same issue. I also transferred her project, that did not have this issue on her machine, to mine. Her program had the same issue when running on my set up.

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/userEmailList.css">
</head>
<body>
<h1>Join our email list</h1>
<p>Please click any button below to perform the desired action </p>

<a href ="delete.jsp"><input type="button" value = "DELETE"></a>
<a href ="insert.jsp"><input type="button" value = "INSERT"></a>
<a href ="update.jsp"><input type="button" value = "UPDATE"></a>

<form action="emailList" method="post">

    <h1>Click the button below to view all records </h1>
    <input type="hidden" name="action" value="select_records">
    <input type="submit" name="action" value="SELECT RECORDS">

</form>
</body>
</html>

servlet

<?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">

    <servlet>
        <servlet-name>EmailListServlet</servlet-name>
        <servlet-class>EmailListServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>EmailListServlet</servlet-name>
        <url-pattern>/emailList</url-pattern>
    </servlet-mapping>

</web-app>

I should be able to run the program both way. But the right click on index.html -> Run does not work

Please try to change URL to " http://localhost:8080/ /index.html". Related issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-206534

Change configuration on tomcat/conf/server.xml file find:

Host name="localhost" appBase="webapps/manager" unpackWARs="true" autoDeploy="true">

Change to appbase path to your application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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