WildFly running, project deployed, but 404

2019-04-24 09:28发布

i cant understand why for the project it return 404 or cant connect to the host, since the wildfly start page open perfectly

My web.xml

<?xml version="1.0"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 <display-name>HelloWorld</display-name>
 <!--
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
-->
 <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>*.jsf</url-pattern>
 </servlet-mapping>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.faces</url-pattern>
 </servlet-mapping>
  <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.xhtml</url-pattern>
 </servlet-mapping>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>/faces/*</url-pattern>
 </servlet-mapping>
</web-app>

enter image description here

标签: java jsf wildfly
2条回答
Ridiculous、
2楼-- · 2019-04-24 10:01

If the answer of ctomc does not work, you need create a file jboss-web.xml in /webapp/WEB-INF directory, with the next content:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web version="13.0"
    xmlns="http://www.jboss.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_13_0.xsd">
    <context-root>/ContextProject</context-root>
</jboss-web>

remember to change the version of wildfly that you use, and specify the context in which your application runs "ContextProject"

查看更多
Ridiculous、
3楼-- · 2019-04-24 10:15

Your application is avalibale at

http://localhost:8080/HelloWorld

as you can see also in your log. entry "register web context: /HelloWorld"

查看更多
登录 后发表回答