1 Reply Latest reply on Apr 3, 2016 7:51 AM by Riya Sharma

    Rest service inaccessible in EAP 6.4

    chad_k Newbie

      i am following the examples from the quickstarts to develop a simple REST service and deploy it in JBoss EAP 6.4.

       

      I created a dynamic web project in jboss dev studio and then turned it into a maven project, added jboss-annotations-api, cdi-api and jboss-jaxrs-api as provided dependencies.

       

      I created a class that will be the service's core as follows

       

      @Path("/")
      public class Application {
      
          @GET
          @Path("/json/{id}")
          @Produces(MediaType.APPLICATION_JSON)
          public Response getMessage(@PathParam("id") @DefaultValue("na") String id){
              String result="{result:'generated message for "+id+"'}";
              return Response.ok(result).build();
          }
      }
      

       

      and a service class that will activate JAX-RS

       

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

       

      I have no web.xml. My application deploys and i see Register web context: /restapp in the server log. However i get a 404 error when i try to access it using http://localhost:8080/restapp/rest/json/test_id.

      I cannot figure out what i am doing wrong.

      Also what archetype do you guys recommend to start a project that will have both rest and soap services, jpa and ejbs in it with?

      thanks