Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Glassfish在JDK 8上部署REST Web服务后抛出状态500_Java_Linux_Web Services_Rest_Glassfish - Fatal编程技术网

Java Glassfish在JDK 8上部署REST Web服务后抛出状态500

Java Glassfish在JDK 8上部署REST Web服务后抛出状态500,java,linux,web-services,rest,glassfish,Java,Linux,Web Services,Rest,Glassfish,我一直在本地机器MacOSX 10.10和Glassfish 4上构建REST Web服务。在我的Mac上,我有Java版本7。 Web服务一直运行良好,直到我将其部署到Linux机器上的Glassfish服务器上,该机器也有Glassfish 4,但有JDK 1.8 源代码: 示例资源: @Path("articles") public class ArticleResource { ArticleService service; public ArticleResource(){

我一直在本地机器MacOSX 10.10和Glassfish 4上构建REST Web服务。在我的Mac上,我有Java版本7。 Web服务一直运行良好,直到我将其部署到Linux机器上的Glassfish服务器上,该机器也有Glassfish 4,但有JDK 1.8

源代码:

示例资源:

@Path("articles")
public class ArticleResource {
ArticleService service;

public ArticleResource(){
    service = (ArticleServiceImpl) SparWebServiceFactory.getService("art");
}

@GET
@Produces("text/plain")
public String getArticles() throws Exception {
    List<ARA1> articles = null;

    try {
        articles = service.getAllArticels();
    }
    catch(SQLException ex){
        throw new WebApplicationException(ex.getMessage());
    }

    if(articles == null){
        throw new WebApplicationException(404);
    }

    JSONArray allArticles = new JSONArray();
    for(ARA1 art : articles){
        JSONObject ara1 = new JSONObject();
        ara1.put("ArtNr", art.getArtNr());
        ara1.put("ArtKName", art.getArtKName());
        ara1.put("ArtName1", art.getArtName1());
        ara1.put("ArtName2", art.getArtName2());
        ara1.put("ArtName3", art.getArtName3());
        ara1.put("ArtTyp", art.getArtTyp());

        JSONObject anf = new JSONObject();
        anf.put("Betrieb", art.getAnforderung().getBetrieb());

        /*
            Berechnen ob der Artikel noch oder schon verkauft werden darf
        */
        Date vkListVon = art.getAnforderung().getVkListVon();
        Date vkListBis = art.getAnforderung().getVkListBis();

        if(vkListVon.after(new Date()) || vkListBis.before(new Date())){
            continue;
        }

        anf.put("VKListVon", vkListVon);
        anf.put("VKListBis", vkListBis);
        ara1.put("ANF1", anf);

        JSONObject fvp = new JSONObject();
        fvp.put("VPID", art.getVpid().getVpid());
        fvp.put("Fil", art.getVpid().getFil());
        fvp.put("FromDate", art.getVpid().getFromDate().toString());
        fvp.put("ToDate", art.getVpid().getToDate().toString());
        fvp.put("VkPreis", art.getVpid().getVkPreis());
        ara1.put("FVP", fvp);

        allArticles.add(ara1);
    }

    return allArticles.toString();
}
我正在用Jersey 2.0创建我的休息服务。 如果我先在JDK1.7上运行,然后在JDK1.8上的linux机器上运行,会出现什么问题

我感谢你的回答。
Alex

那么错误消息/stacktrace在哪里?那么你正在Mac上构建应用程序,然后将其部署到linux?你能试着在Mac上构建你的应用程序,看看是否有构建错误吗?是的,问题也在于stacktrace。它只是在浏览器中显示错误500。Glassfish在日志中没有错误。我在我的mac上构建我的Web服务,然后我把它放在我的linux机器上,并在Glassfish中部署它。