glassfish server does not generate me json

0

I have a web service in Netbeans that takes the mysql data I have in a remote glassfish server. When I test the service in local, it generates both the xml and the json. The problem I have when I upload the service to the server that does not generate the json, the xml if.

The code of the get method of a table in the database is:

@GET
    @Override
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public List<Estats> findAll() {
        return super.findAll();
    }

In the Postman I get the XML and if I change to JSON I get Unexpected '<' . When I open the url in the browser, it only shows me the xml.

I have tried to remove the MediaType.APPLICATION_XML so that it does not show me the xml and I get the following error:

That is:

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.

How can I solve this? Thank you very much.

    
asked by Montse 21.03.2017 в 13:11
source

1 answer

0

How about,

Apparently it is a bug of Glassfish 4.1.1, what I do is download the .jar from org.eclipse.persistence.moxy-2.6.0.jar and replace it by being in / $ GLASSFISHINSTALL / glassfish / modules leave it with the name org.eclipse.persistence.moxy.jar as was the other

    
answered by 05.10.2017 в 05:13