I have a RESTful service created in Netbeans that takes the data from a remote database that I have in mysql. I followed the steps of this web: link (in this example they create a database. I have created on the remote server that I have virtual). In local it works well, but when I deploy it to the remote Glassfish server I get an error:
> Error occurred during deployment: Exception while deploying the app
> [ProjecteRepairManage] : Class service.PrioritatFacadeREST has
> unsupported major or minor version numbers, which are greater than
> those found in the Java Runtime Environment version 1.7.0_80. Please
> see server.log for more details.
The code for the service.PrioritatFacadeREST class is:
package service;
import entities.Prioritat;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Stateless
@Path("entities.prioritat")
public class PrioritatFacadeREST extends AbstractFacade<Prioritat> {
@PersistenceContext(unitName = "ProjecteRepairManagePU")
private EntityManager em;
public PrioritatFacadeREST() {
super(Prioritat.class);
}
@POST
@Override
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void create(Prioritat entity) {
super.create(entity);
}
@PUT
@Path("{id}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void edit(@PathParam("id") Integer id, Prioritat entity) {
super.edit(entity);
}
@DELETE
@Path("{id}")
public void remove(@PathParam("id") Integer id) {
super.remove(super.find(id));
}
@GET
@Path("{id}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Prioritat find(@PathParam("id") Integer id) {
return super.find(id);
}
@GET
@Override
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<Prioritat> findAll() {
return super.findAll();
}
@GET
@Path("{from}/{to}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List<Prioritat> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
return super.findRange(new int[]{from, to});
}
@GET
@Path("count")
@Produces(MediaType.TEXT_PLAIN)
public String countREST() {
return String.valueOf(super.count());
}
@Override
protected EntityManager getEntityManager() {
return em;
}
}
I understand that it tells me that the Java version is not correct. The computer where I am working has the Java 1.8 version. If the change to 1.7 gives me exactly the same error.