Pregunta

I get a 404 error when I run my project, my JBoss server is running fine.

Here is in the index.html:

<html>
<body>

<form action="/services/customers" method="post">
First Name: <input type="text" name="firstname"/><br/>
Last Name: <input type="text" name="lastname"/><br/>
<INPUT type="submit" value="Send">
</form>

</body>
</html>

And here is the web.xml file:

<?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_3_0.xsd" version="3.0">
<display-name>SIMS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.wcs.rs.Application</param-name>
<param-value>org.jboss.samples.webservices.MyRESTApplication</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<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>
</web-app>

And here is my file structure:

enter image description here

When I run this project I get a 404 error

http://localhost:8080/SIMS/

I also tried:

http://localhost:8080/SIMS/index.html

This also gave a 404 any ideas on how to get the project to run?

¿Fue útil?

Solución

I think the problem is the <url-pattern>. The jsf library can't find your page.

Try change your <url-pattern> to <url-pattern>*.jsf</url-pattern>

Then rename the <welcome-file> to index.jsf and create an empty index.jsf file next to index.html.

Otros consejos

try just typing in localhost and select your file from the browsing tree

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top