Fórum [Java Rest] Erro ao retornar JSON #596670
25/08/2018
0
\\\\ Classe do obj test
public class test {
private String nome;
private String idade;
public test() {
this.nome = "";
this.idade = "";
}
public String getNome() { return nome; }
public void setNome(String nome) { this.nome = nome; }
public String getIdade() { return idade; }
public void setIdade(String idade) { this.idade = idade; }
}
\\\\Applet
@Path("/teste")
public class teste {
@GET
@Path("/list")
//@Produces(MediaType.APPLICATION_JSON + CHARSET)
@Produces(MediaType.APPLICATION_JSON)
public test listar() {
test Jean = new test();
Jean.setIdade("26");
Jean.setNome("Jean");
System.out.println(Jean.getNome()+Jean.getIdade());
return Jean;
}
}
\\\\Erro no navegador
HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper
root cause
org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper
root cause
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.
Obrigado!
Jean Oliveira
Curtir tópico
+ 0Post mais votado
25/08/2018
José Soares
Gostei + 1
Mais Posts
25/08/2018
Jean Oliveira
Gostei + 0
26/08/2018
Jean Oliveira
Link da solução: https://www.ivonet.nl/2016/09/06/Could%20not%20initialize%20class%20org.eclipse.persistence.jaxb.BeanValidationHelper/
Gostei + 1
26/08/2018
José Soares
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)