Wildfly Resteasy给我404错误,没有记录

时间:2015-01-16 09:22:41

标签: rest jboss resteasy wildfly

我有一个非常简单的RESTeasy示例,在Mac上运行wildfly 8.2。

它只包含两个类:

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("/")
public class RestApp extends Application {
}

=

import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path("/test")
@Stateless
@LocalBean
public class TestTheRest extends Application {

   @GET
  @Produces({MediaType.APPLICATION_JSON})
   public Response getBookingDetails() {
        String hello = "Hi";
        return Response.ok(hello).build();
  }

}

浏览/ warname会给我"禁止"尝试使用" / warname / test&#34时应该没问题;将返回404未找到。同样在server.log中我在发出请求时什么都看不到? 我在这里错过了什么吗?

[0m [0m19:03:54,777 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017534: Registered web context: /logicshop
[0m [0m19:03:54,814 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "logicshop.war" (runtime-name : "logicshop.war")
[0m [0m19:03:54,823 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
[0m [0m19:03:54,823 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
[0m [0m19:03:54,823 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 3018ms - Started 262 of 317 services (92 services are lazy, passive or on-demand)
[0mConnected to server
[2015-01-15 07:03:54,836] Artifact logicshop: Artifact is being deployed, please wait...
[0m19:03:54,899 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017535: Unregistered web context: /logicshop
[0m [0m19:03:54,918 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-1) HV000001: Hibernate Validator 5.1.3.Final
[0m [0m19:03:54,966 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-13) JBAS015877: Stopped deployment logicshop.war (runtime-name: logicshop.war) in 71ms
[0m [0m19:03:55,013 INFO  [org.jboss.as.server] (management-handler-thread - 2) JBAS018558: Undeployed "logicshop.war" (runtime-name: "logicshop.war")
[0m [0m19:03:55,079 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015876: Starting deployment of "logicshop.war" (runtime-name: "logicshop.war")
[0m [0m19:03:55,138 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017534: Registered web context: /logicshop
[0m [0m19:03:55,149 INFO  [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "logicshop.war" (runtime-name : "logicshop.war")
[0m[2015-01-15 07:03:55,165] Artifact logicshop: Artifact is deployed successfully
[2015-01-15 07:03:55,165] Artifact logicshop: Deploy took 329 milliseconds

2 个答案:

答案 0 :(得分:0)

我有一些具有hibernate依赖关系的dao和实体。 我删除了那些,现在它有效吗?

答案 1 :(得分:0)

好吧最后我发现如果将persistence.xml放在" WEB-INF"中,就会发生这种情况。而不是" META-INF"。现在它有效。