Jboss Wildfly应用程序-can';不提供静态内容

Jboss Wildfly应用程序-can';不提供静态内容,jboss,wildfly,wildfly-10,Jboss,Wildfly,Wildfly 10,我正在做一个Wildfly应用程序项目,我面临一个问题。 我配置了web.xml,在webapp文件夹中有一个index.html文件。 起初,这个页面很有效,每次我转到“localhost/myapp/”时,它都会显示这个页面。 但是服务器决定不再给我提供页面,现在每次我尝试访问页面时,都会得到一个空白页面。 即使我尝试直接访问资源,也会得到一个空白页: “localhost/myapp/index.html” 在控制台中,我有以下堆栈跟踪: 15:50:19,729 ERROR [org.j

我正在做一个Wildfly应用程序项目,我面临一个问题。 我配置了web.xml,在webapp文件夹中有一个index.html文件。 起初,这个页面很有效,每次我转到“localhost/myapp/”时,它都会显示这个页面。 但是服务器决定不再给我提供页面,现在每次我尝试访问页面时,都会得到一个空白页面。 即使我尝试直接访问资源,也会得到一个空白页: “localhost/myapp/index.html”

在控制台中,我有以下堆栈跟踪:

15:50:19,729 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-12) RESTEASY002010: Failed to execute: javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/jboss-helloworld-html5/
at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:75)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:445)
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:257)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:194)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Web.xml:

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-app_3_0.xsd">
 <servlet-mapping>
  <servlet-name>javax.ws.rs.core.Application</servlet-name>
  <url-pattern>/*</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
 </welcome-file-list>
</web-app>
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-app_3_0.xsd">
javax.ws.rs.core.Application
/*
index.html

我相信您的URL模式正在吞噬一切,包括对静态html页面的请求。您的web.xml应该是这样的,注意“hello”可以更改为您喜欢的任何内容,但必须与您在浏览器中放置的内容相匹配,以便在浏览器中显示地址


javax.ws.rs.core.Application
/你好/*
index.html
可以通过以下方式访问静态文件:



您是否试图使用RESTful/RESTEasy,因为JBoss似乎认为您的应用程序是RESTful应用程序?我正在使用基于“JBoss-helloworld-html5”示例的RESTful/RESTEasy servlet。您是否需要其他文件?能否使用web.xml内容更新您的问题?到目前为止,您是否对jboss-helloworld-html5进行了任何修改,我想说我可以尝试一下-注意,我使用的是jboss EAP 7,但我相信它是基于WildFly 10更新的。不,不是很多,只是添加了一些导入的包并创建了一个新的restful服务,但这个问题从一开始就出现了。我猜,但很确定这就是导致它的原因。
/*
这基本上是说我希望所有内容都映射(发送)到该servlet,这样欢迎文件列表就可能被覆盖。尝试更具体地使用servlet的URL,比如
/MyServlet
——让我给您举个例子
<web-app version="3.1" 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_3_1.xsd">
    <!-- One of the ways of activating REST Services is adding these lines.
         The server is responsible for adding the corresponding servlet automatically.
         The class org.jboss.as.quickstarts.html5rest.HelloWorld class has the
         annotation @Path("/") to receive the REST invocation -->
    <servlet-mapping>
        <servlet-name>javax.ws.rs.core.Application</servlet-name>
        <url-pattern>/hello/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
</web-app>