Glassfish5: JSF FacesServlet is not called

53 Views Asked by At

Glassfish5: JSF FacesServlet is not called.

example.ear

    example_ejb.jar
    example_web.war

    META-INF/application.xml

META-INF/application.xml

<application 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/application_8.xsd"
             version="8">
    
    <module>
        <ejb>example_ejb.jar</ejb>
    </module>
    
    <module>
        <web>
            <web-uri>example_web.war</web-uri>
            <context-root>example_web</context-root>
        </web>
    </module>


    <library-directory>lib</library-directory>
</application>

example_web.war

WEB-INF/web.xml
home.xhtml

WEB-INF/web.xml

<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>
        <display-name>Faces Servlet</display-name>
        <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>
    
</web-app>

Deployed example.ear to Glassfish5, successful. But

http://localhost:8080/example_web/home.xhtml

HTTP Status 404 - Not Found

Set breakpoint in FacesServlet.java, the service() method is not called in debug mode.

0

There are 0 best solutions below