Tomcat maven web project rest application do not work netbeans

0

Personal I created a simple application to make a web service I did it as follows

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.java class

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 I run on glassfish, netbeans opens the browser and shows me link

My problem is that I want to run on tomcat When I squeeze in tomcat it does not open the browser for me and when I enter the address link I have 404 error

While in glassfish it is working.

Can anyone help me?

I do not know what's going on with my tomcat. when I do the manual deploy on it also I can not call the address that I have 404

    
asked by anonymous 29.03.2018 / 23:01

1 answer

0

If you are not using the TomEE version (which supports the features of the JAX-RS package), you will need to add the following dependency in your project (assuming you are using maven):

<dependency>
    <groupId>org.glassfish.jersey.bundles</groupId>
    <artifactId>jaxrs-ri</artifactId>
    <version>2.26</version>
</dependency>
    
04.04.2018 / 04:03