HTTP Status 500 - Internal Server Error

Asked

Viewed 500 times

0

After trying to make a call in the Glasfish Webservice is occurring the error below, I am trying to make a call in the Webservice Rest Json, in the XML Rest call it runs normally.inserir a descrição da imagem aqui

package br.com.devmedia.ws.rest.example1;

import java.util.Random;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;

@Path("ceprest")
public class CepRestWS {

    @Context
    private UriInfo context;

    public CepRestWS() {
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("getCep/{cep}")
    public Cep getCep(@PathParam("cep") String cep) {
        Cep toReturn = new Cep();
        toReturn.setCep(cep);
        toReturn.setBairro("Bairro " + new Random().nextInt());
        toReturn.setNumero(new Random().nextInt());
        toReturn.setRua("Rua que sempre " + new Random().nextInt());
        toReturn.setUf("PR");
        return toReturn;
    }

}
  • Try copying the Jersey Jars to the WEB-INF lib folder

  • @Reginaldorigo downloaded the Jersey Jars, applied it directly to the WEB-INF lib folder, after which the IDE did not even let me deploy the application, returning the following error: Cannot deploy Webserverdevmediaear deploy is failing=Error occurred During Deployment: Exception while loading the app : java.lang.Illegalstateexception: Containerbase.addChild: start: org.apache.Catalina.Lifecycleexception: org.apache.Catalina.Lifecycleexception: java.lang.Classnotfoundexception: javax.json.bind.JsonbException. Please see server.log for more Details.

  • Complicated. Right? I think you have problems between versions. Now you have to take it easy, start over, and go step by step.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.