Is a JAX-RS web module required WARor am I doing something wrong?
Each tutorial shows how to set up rest's service web.xml. But there is no ejb module web.xml. Should I create WARjust for the leisure service?
In my ejb module, I want to open EJB as a recreation service, but I cannot get it to work. Calling "localhost: 8080 / EjbModule / rest / test / method" results in 404
Project structure
- ear
- EjbModule.jar
the code
Providing Bean as a JAX-WS web service and testing it in a browser is not a problem.
@ApplicationPath("rest")
public class RestApplication extends Application
{
@Override
public Set<Class<?>> getClasses()
{
final Set<Class<?>> classes = new HashSet<>(1);
classes.add(TestService.class);
return classes;
}
}
@Stateless
@Path("/test")
public class TestService
{
@Path("/method")
@GET
@Produces(MediaType.TEXT_HTML)
public String test()
{
return new Date().toString();
}
}
Environment: Glassfish 4.0
Edit:
Creating a separate WARbreakpoint service works as expected.
source
share