部署在 WildFly 但仍然收到 404

Deployed on WildFly but still getting 404

我指的是following helloworld example

我的应用程序已使用 WildFly 9.x 成功部署在我的 eclipse 上,如下面的屏幕截图和控制台日志所示:

这是 eclipse 控制台日志的详细信息:

14:08:16,447 INFO  [org.jboss.modules] (main) JBoss Modules version 1.4.3.Final
14:08:17,156 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
14:08:17,293 INFO  [org.jboss.as] (MSC service thread 1-4) WFLYSRV0049: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) starting
14:08:19,873 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 19) WFLYCTL0028: Attribute 'job-repository-type' in the resource at address '/subsystem=batch' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
14:08:19,890 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 11) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=ExampleDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
14:08:19,908 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found JAX-RS_examples.war in deployment directory. To trigger deployment create a file called JAX-RS_examples.war.dodeploy
14:08:19,953 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
14:08:19,993 INFO  [org.xnio] (MSC service thread 1-3) XNIO version 3.3.1.Final
14:08:20,007 INFO  [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.3.1.Final
14:08:20,075 INFO  [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 4.0.9.Final
14:08:20,106 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0003: Undertow 1.2.9.Final starting
14:08:20,213 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 38) WFLYCLINF0001: Activating Infinispan subsystem.
14:08:20,183 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
14:08:20,179 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 46) WFLYNAM0001: Activating Naming Subsystem
14:08:20,110 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0003: Undertow 1.2.9.Final starting
14:08:20,164 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
14:08:20,164 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 56) WFLYWS0002: Activating WebServices Extension
14:08:20,136 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 37) WFLYIO001: Worker 'default' has auto-configured to 4 core threads with 32 task threads based on your 2 available processors
14:08:20,106 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 53) WFLYSEC0002: Activating Security Subsystem
14:08:20,377 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:08:20,684 INFO  [org.jboss.as.connector] (MSC service thread 1-3) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.5.Final)
14:08:20,975 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = h2
14:08:20,985 INFO  [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service
14:08:21,016 INFO  [org.jboss.as.security] (MSC service thread 1-3) WFLYSEC0001: Current PicketBox version=4.9.2.Final
14:08:21,158 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
14:08:21,194 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path D:\Users\dan\wildfly-9.0.2.Final/welcome-content
14:08:21,246 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: Started server default-server.
14:08:21,264 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting
14:08:21,727 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
14:08:22,413 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory D:\Users\dan\wildfly-9.0.2.Final\standalone\deployments
14:08:22,475 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "JAX-RS_examples.war" (runtime-name: "JAX-RS_examples.war")
14:08:22,885 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final
14:08:23,423 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
14:08:25,131 INFO  [org.jboss.resteasy.spi.ResteasyDeployment] (ServerService Thread Pool -- 61) Deploying javax.ws.rs.core.Application: class com.thejavageek.jaxrs.ExampleApplication
14:08:25,203 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 61) HV000001: Hibernate Validator 5.1.3.Final
14:08:25,283 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 61) WFLYUT0021: Registered web context: /JAX-RS_examples
14:08:25,463 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "JAX-RS_examples.war" (runtime-name : "JAX-RS_examples.war")
14:08:25,939 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
14:08:25,941 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
14:08:25,942 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 9899ms - Started 272 of 453 services (221 services are lazy, passive or on-demand)

我正在尝试像这样访问应用程序:

http://127.0.0.1:9990/JAX-RS_examples/rest/HelloWorld/sayHello

并且找不到 404。

遇到过类似的线程,但无法弄清楚:

WildFly running, project deployed, but 404

有人已经告诉你了。 您使用端口 9990 调用 REST 服务。 但是,此端口来自管理控制台。

默认情况下,正确的端口应为 8080。因此,只需调用:

http://127.0.0.1:8080/JAX-RS_examples/rest/HelloWorld/sayHello

运行时名称需要 .war 符号。