Tomcat message with JSF error 403

Asked

Viewed 263 times

0

I’m using the netbeans 8.1 to develop a JSF application, but when I run the facelets template appears the message I’m posting on the forum.

Man Tomcat was installed along with netbeans, and I have already searched on some forums have instructed me to change the type of administrator Tomcat was using. I have already put as manager-Gui, manager-script and nothing solved.

Someone could help me with this mistake?

Imagem aqui

Project structure inserir a descrição da imagem aqui

Filing cabinet web.xml:

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">

    <display-name>semeru_jsf_maven</display-name>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <!--        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>-->
    </welcome-file-list>

    <!-- Duração da sessão -->

    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

        <!-- Configurações do tema do PrimeFaces -->
    <context-param>  
        <param-name>primefaces.THEME</param-name>  
        <param-value>sam</param-value>  
    </context-param>       

        <!-- Configurações do JavaServer Faces -->

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

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

    <!-- SOLUÇAO foi tirar o bloqueador de xhtml
    <security-constraint>
        <display-name>Bloqueia o browser de acessar arquivos xhtml</display-name>
        <web-resource-collection>
            <web-resource-name>xhtml files</web-resource-name>
            <url-pattern>*.xhtml</url-pattern>
        </web-resource-collection>
        <auth-constraint/>
    </security-constraint> -->

    <!-- Configurações do PrimeFaces -->

    <servlet>
        <servlet-name>Resource Servlet</servlet-name>
        <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resource Servlet</servlet-name>
        <url-pattern>/primefaces_resource/
    </servlet-mapping>

</web-app>

Filing cabinet faces-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_2_0.xsd"
              version="2.0">

    <lifecycle>
        <phase-listener>br.com.semeru.util.PhaseListenerSemeru</phase-listener>
    </lifecycle>

</faces-config>
  • Can you post a screenshot of the structure of your project? The context of the url is set?

  • Douglas this and the project structure, which url context vc refers to?

  • It was meant to check, in this case it’s probably the /JSF/ in the address bar, in which it comes right after ip:port. Any other resource within the Resources folder, such as CSS is read smoothly? Do you have any configuration in web.xml or any other file, matching the page path? Pages outside the Resource folder are normally accessed?

  • How’s your faces-config? How’s your web.xml?

  • Douglas, Bruno put the codes of the two files, for you to analyze. Thank you for the help!

  • You have a security Constraint that blocks access directly to XHTML, already tried something like localthos:8084/JSF/resources/main.faces? Another thing, the web.xml posted is wrong, is not closing a url-pattern of a servlet-mapping.

  • Bruno thank you very much was the security restriction!

  • Michell, how nice that you solved the problem. Could you post the solution found as the answer just below? so it may be good for someone in the future.

  • I commented on the restriction that blocked access to xhtml!

  • @Michellxexeu publish the answer and mark with accepted, so you can help other people.

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.