I am new to Java based Web Development.
I am using Eclipse Version: 2018-09 (4.9.0), JDK 1.8, Tomcat v9.0
I am currently building a tutorial Jersey Maven project. I just created an API endpoint but am getting status 500. The problem is I don't know how to debug it.
here is the controller code
@Path("aliens")
public class AlienResource {
@GET
@Produces(MediaType.APPLICATION_XML)
public Alien getAlien() {
Alien a1 = new Alien();
a1.setName("hello");
a1.setPoint(23);
System.out.println("*****");
System.out.println(a1);
return a1;
}
}
The eclipse console has no errors. It does have the System.out.println("*****")
and System.out.println(a1);
, which means that the function getAlien()
is being called.
Upon researching the internet I found that Tomcat in eclipse prints out the server logs in the console itself, however, using this link I did try to redirect the logs to some other file, catalina.out
which I created inside my workspace. I also did a sudo chmod a+w catalina.out
in order to avoid any permissions issue. But catalina.out
remains empty.
I don't understand how do I debug the 500 error and where will I get the error log?
PS: the default API endpoint provided by jersey works ie. http://localhost:8080/demorest/webapi/myresource works fine.