1

I'm trying to deploy a simple web application under Jboss AS 7.1.1 which exposes JAX-RS services, using Resteasy. According to Resteasy docs (I've updated resteasy to 3.0 beta 2), there's no need to put anything in web.xml, so I created an empty web project in eclipse and used the following web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
    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">
</web-app>

I also have an application class:

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

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


}

and a class to implement the actual service:

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path( "/test" )
public class Login {

   @GET
   @Produces(MediaType.TEXT_HTML)
   public Response login()  {
      return Response.ok( "logged in" ).build();
   }

}

Unfortunately, when I startup the server and try to reach the application, I see a 404 error.

I also tried to run one of the examples bundled with Resteasy distribution (examples/oreilly-workbook-as7/ex03_1) using maven but, after correctly build and deploy the war, it fails to run tests:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.restfully.shop.test.CustomerResourceTest
*** Create a new Customer ***
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.53 sec <<< FAILURE!

Results :

Failed tests:   testCustomerResource(com.restfully.shop.test.CustomerResourceTest): expected:<201> but was:<404>

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

I can't figure out what am I missing. What's wrong with my project?

loscuropresagio
  • 1,922
  • 15
  • 26

1 Answers1

2

I have just copy past your code, it works (I just don't have any web.xml).

I can connect to http://localhost:8080/warname/rest/test and logged in is returned.

Kazaag
  • 2,115
  • 14
  • 14
  • 1
    Thanks for your answer. I started to look on the server side an i figured out the problem was related to JBoss configuration. – loscuropresagio Jan 30 '13 at 11:58