Q:

Jee6 Basic Rest service returns 404

I'm currently switching from Spring Framework to JEE6 and am PoC testing some functionalities. One of them are Rest services. I'm pretty sure that I followed the JEE6 tutorial using rest annotations and also cross-checked the JEE5 sample for rest webservices. However, my example does return a 404 message. A normal @WebServlet controller is running okay, so I don't have any internal/deployment related errors. Log-file/ Stacktrace is also empty.
Would be great if you could give me some advice. Thanks!
J

Controller class
package guest;

import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;

// The Java class will be hosted at the URI path "/helloworld"
@Stateless
@Path("/helloWorld")
public class GuestRest {

    // The Java method will process HTTP GET requests
    @Path("test")
    @GET
    public String getClichedMessage() {
        // Return some cliched textual content
        return "<html><body><h1>Hello World</h1></body></html>";
    }
}

glassfish-web.xml

<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <context-root>/Guestbook</context-root>

</glassfish-web-app>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

A:

Try to change your web.xml like this (3.0 version and different REST initialization):
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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">
    <display-name>JAXRSSample</display-name>
    <servlet>
        <servlet-name>javax.ws.rs.core.Application</servlet-name>
    </servlet>

    <servlet-mapping>
        <servlet-name>javax.ws.rs.core.Application</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

