I followed the tutorial here
And i can't get the example running for some reason... i'm getting 404 error on entering the url http://localhost:8080/greeting/ after running the service.
I'm using Intellji EE 14 and TomEE 7.
Here is my code:
Greeter.java:
package org.mybiz;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("greeting")
public class Greeter {
@GET
public String sayHi() {
return "Hi!!";
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
</web-app>
Can you check it is deployed in the logs (you should have the http://localhost:8080/greeting/)
If not their is maybe a compilation issue, if yes and you get an exception accessing the url it can be you access it with a mimetype not matching the defined one.
Try adding @Consumes("text/plain")
or @Consumes("text/html")