I'm using JBoss 9.x Application Server and I want to create a REST api to communicate with my EJBs. I created two classes PlayerRestApi and PlayerEJB and deploy it to wildfly, but when I requested /player the response is always 404.
Note: I will post the PlayerRestApi class with a dummy return.
PlayerRestApi code:
@Local
@Path("/player")
@Consumes("application/json")
@Produces("application/json")
public class PlayerRestApi{
PlayerEJB player;
@GET
public Map<String, String> getPlayer(){
Map<String, String> r = new HashMap<String,String>();
r.put("Name","Ronaldo");
return r;
}
}
When I tried this route, localhost: http://localhost:28070/appname/player Wildfly returns 404.
I was deploying a jar file instead of a war file, so the wildfly returns 404. The code it's correct and works.
Note This version of Wildfly Application Server doesn't need the web.xml file.