2

I'm trying to deploy my demo application on a local Weblogic server. There's no errors while deployment and it goes totally fine, but nonetheless welcome page just throws 404 error. Am I doing something wrong? There're my config files

faces-config.xml

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

</faces-config>

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>PrimeFaces Web Application</display-name>

    <!-- Change to "Production" when you are ready to deploy -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <!-- Welcome page -->
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>

    <!-- JSF mapping -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Map these files with JSF -->
    <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>*.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>
</web-app>

index.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>
<h:body>
   <h1>Hello World PrimeFaces</h1>

   <h:form>
      <p:editor value="#{demo.name}" />
   </h:form>

</h:body>
</html>

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

    <persistence-unit name="myUnit" >
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>java:/PostgresDB/</jta-data-source>
        <class>com.egar.store.domen.Order</class>
        <class>com.egar.store.domen.OrderDetail</class>
        <properties>
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.format_sql" value="true" />
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" />
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform" />

        </properties>
    </persistence-unit>

</persistence>

Connection to local database passes the test. And the error I get when server is started is 10.4.5 404 Not Found The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. Also there's project structure in case I should replace something

structure

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Johnny B. Goode
  • 121
  • 1
  • 10
  • 3
    Yeah, try moving `index.xhtml` into `webapp/` instead of `webapp/WEB-INF/` - that should sove your problem. `WEB-INF` is meant for private and privately references resources. There are probably answers on the site that solve/answer this already. – Adam Waldenberg Mar 27 '20 at 18:09
  • Replace the p:editor with ab h:inputText. Does it work? No? Not PrimeFaces relates. Rename the file to index.html an put plain html in there. Does it work? No? Not jsf related. Does it work on Wuldfly? No? Not weblogic related. These are steps you should take as a developer – Kukeltje Mar 27 '20 at 18:25
  • well, it doesn't work in all these cases, I've tried it on Tomcat and it's just the same - 404 on sturtup – Johnny B. Goode Mar 27 '20 at 18:38
  • So it must be a non PrimeFaces non JSF thing... https://www.google.com/search?client=firefox-b-d&q=welcome+page+results+in+404+java+webapp+war (hint: @AdamWaldenberg is right!) – Kukeltje Mar 27 '20 at 19:25
  • 1
    Does this answer your question? [JSF files inside WEB-INF directory, how do I access them?](https://stackoverflow.com/questions/3512234/jsf-files-inside-web-inf-directory-how-do-i-access-them) – fuggerjaki61 Mar 28 '20 at 09:01

0 Answers0