简体   繁体   中英

Get HTTP Status 404 - Not Found, when the name of a dynamic web project renamed and deployed on Glassfish with Eclipse

When I rename the name of a dynamic web project with JSF v2.2 as configuration created by itself Eclipse 2019.03 then I redeploy it on glassfish v5.1 with Eclipse, gets HTTP Status 404 - Not Found... While it was working well before renaming project name.


web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>test1</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>
</web-app>  


There is a simple index.xhtml in /WebContent

I noticed when a new dynamic web project with JSF as configuration has been created by itself Eclipse, if you use Glassfish as server, there will be an additional file named glassfish-web.xml in /WebContent/WEB-INFO directory.
When the name of a dynamic web project is renamed, the line below of glassfissh-web.xml file should be modified manually to new name of the project:

<context-root>/testProject</context-root>

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