简体   繁体   English

找不到带有Wildfly的Rest Web服务的404

[英]404 not found for a Rest Web service with wildfly

I am following this tutorial Crunchify tutorial to create a Rest web service but I can't get past step 5 since each time it gives me a 404 error. 我正在按照本教程Crunchify教程来创建Rest Web服务,但是由于每次它给我一个404错误,我无法走过步骤5。 I am using Maven, on eclipse with Wildfly server. 我正在使用Wildfly服务器在Eclipse上使用Maven。 this is my web.xml 这是我的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"    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <display-name>CrunchifyTutorials</display-name>
    <servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servletclass>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>
</web-app>

You can use .htaccess file: 您可以使用.htaccess文件:

ErrorDocument 404 "http://example.com/xml/404.xml"

Hope it'll helps you. 希望对您有帮助。

maybe try to set 也许尝试设置

<url-pattern>/</url-pattern>

and then go to / in you browser url 然后转到/在您的浏览器网址中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM