在将tomcat迁移到wildfly 10之后,在JSF上找不到404

时间:2016-09-29 15:59:49

标签: jsf primefaces jsf-2 jboss wildfly

我在tomcat上有一个小项目,它运行良好,现在我决定迁移到wildfly 10。 部署还可以,但是当我想显示我的jsf(primefaces)页面时,它会返回我找不到的404。我不知道我要做什么因为我在控制台上看到任何错误。怎么了,有什么问题?

我的web.xml:

prepare-statement

我的primefaces页面返回404找不到(这种类型的返回对于我所有的xhtml页面都是相同的)。即使我创建一个简单的helloWorld.xhtml页面,它也会返回“404 not found”:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

typedef struct Square {
    int value;
    int **array;
} Square;

Square * generate();

int main(int argc, char *argv[]){
    Square *sqrptr = generate();

    printf("%d\n", sqrptr -> value);
    /* It prints 1 */

    /* Print out the 2D array */
    int i,j;
    for (i = 0; i < 3; i++){
        for (j = 0; j < 3 ; j++){
            printf("%d ", *(*((sqrptr -> array) + i) + j));
        }
        printf("\n");
    }
    /* It gives segmentation fault */

    return 0;
}

Square * generate(){
    Square* mySquare = (Square*) malloc(sizeof(Square)); //c++ compiler
    //Square* mySquare = (void*) malloc(sizeof(Square)); //c compiler
    mySquare->value = 1;
    mySquare->array = malloc(sizeof(int*) * 3);

    /* Initialize the 2D array */
    int i,j;
    for (i = 0; i < 3; i++){
        *(mySquare->array + i) = malloc(sizeof(int) * 3);
        for (j = 0; j < 3; j++){
            *(*(mySquare->array + i) + j) = 0;
        }
    }

    /* Print out the 2D array */
    for (i = 0; i < 3; i++){
        for (j = 0; j < 3l ; j++){
            printf("%d ", *(*(mySquare->array + i) + j));
        }
        printf("\n");
    }
    /* I can see the complete 2D array here */
    return mySquare;
}

我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

  <display-name>Watchlist</display-name>
  <welcome-file-list>
    <welcome-file>Search.xhtml</welcome-file>
  </welcome-file-list>
  <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>bluesky</param-value>
  </context-param>
  <servlet>
    <servlet-name>facesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping> 
</web-app>

我的控制台视图,当我启动我的wildfly服务器时:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"> 

<h:head>


<style>
    input[type=text] {
    color: red;
    text-align: left;
    cursor: pointer;
    display: block;
    width: 70%;
}

::-webkit-input-placeholder {
    color: grey;
}

fieldset {
    width: 400px;
}
</style>


</h:head> 
<body>

<h1>Test</h1> 

<h:form method="post" action="Movies.xhtml">

    <p:inputText  type="text" value="#{tshiliflixBean.m.title}" placeholder="Rechercher un film, un artiste..."/>
    <p:commandButton value="Rechercher " action="#{tshiliflixBean.ListFilmSearch()}"/>

    </h:form>
</body>
</html> 

1 个答案:

答案 0 :(得分:0)

我发现自己问题在哪里。我的web.xml并不好。我发布了一个好人,他会遇到与我相同的问题

> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">


  <display-name>Watchlist</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>*.xhtml</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>/Tshiflix-0.0.1-SNAPSHOT/Search.xhtml</welcome-file>
</welcome-file-list>


</web-app>