0
Personal created a simple application to make a web service I did it this way
netbeans file -> new project -> Maven (web application) I created a class called Restapplication
package br.com.teste.testeteste.rest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
*
* @author Rafael
*/
@ApplicationPath ("/resources")
public class RestApplication extends Application{
}
Then I created a Test class.java
package br.com.teste.testeteste;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
*
* @author Rafael
*/
@Path ("/test")
public class Test {
@GET
@Produces (MediaType.TEXT_PLAIN)
public String primeiro(){
return"Meu primeiro WebService REST!";
}
}
when running on glassfish netbeans opens the browser and shows me http://localhost:8080/test
my problem is that I want to run on Tomcat when I run on Tomcat it does not open the browser for me and when I enter the address http://localhost:8080/tester/Resources/test have error 404
while the glassfish is working.
someone can help me ?
I don’t know what’s going on with my Tomcat. when I deploy the manual on it I can’t call the address I have 404
Are the two servers active? If so, make sure there is no problem with port usage competition.
– Weslley Tavares
the servers are not active at the same time and have no door competition
– foxlaw
Try deploying the manual and go to the Tomcat administration console. Once this is done, enter the application option and see what is the URL your application is being made available at
– Weslley Tavares
Weslley, I did what you suggested and when I click on the application after deploying in the application part I have the following link http://localhost:8081/testeteste/ it opens my index.html until then everything right but when I try to access the http link://localhost:8081/testeteste/Resources/test have 404 as return. would have some suffmanagement ?
– foxlaw
Are you using standard Tomee or Tomcat? It may be that your problem is right there, since standard Tomcat does not come with native support for JAX-RS Annotations, unlike Glassfish.
– Weslley Tavares