I make the JAX-RS application, as from the book Gonçalves. I work in the idea. Server: TomEE. I use Jersey. Deploy is not via web.xml, but via @ApplicationPAth
. The application (root directory) is called example
.
Actually, the class for deployment:
@ApplicationPath("rs") public class RestDeploy extends Application { private final Set<Class<?>> classes; public RestDeploy() { HashSet<Class<?>> c = new HashSet<>(); // сама служба c.add(DBWriter.class); classes = Collections.unmodifiableSet(c); } @Override public Set<Class<?>> getClasses() { return classes; } }
The service itself:
@Stateless @Path("/rest") public class DBWriter { @PersistenceContext EntityManager entityManager; @GET public void getNote() { System.out.println("ТРУЛЯЛЯ"); } }
What I expect: when I try to call a service from a log in there will be a message in the console.
The application deploys to the server normally, and the service itself does not deploitsya Everything is as usual in the logs, "the artifact is successfully dead the server is working".
When you start the project, the локалхост 8081
page automatically opens.
As I try to call the service: adding /example/rs/rest
, or /rs/rest
, or just /rest
after the port, I combine everything more shortly, but still a 404 error appears and nothing is output to the console. What am I doing wrong?