org.glassfish.jersey.server.ContainerException:java.lang.NoClassDefFoundError:org / jsoup / Jsoup

时间:2017-12-02 13:39:19

标签: java web-services glassfish

我正在制作网络服务。 İt将返回Twitter个人资料照片的URL,其中包含用户名。

当我回复文字时,没有任何问题。当我添加我的代码时,它会在上传的照片上给我错误。

我认为我的代码有错误。请帮帮我。

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.lang.String;
import java.io.IOException;

@Path("/url_processes")
public class Url_Processes {
    @GET

    @Produces("text/plain")
    public String get_url(String username)
    {
        Document doc;
        try {
            doc = Jsoup.connect("http://twitter.com/" + username).get();
            Elements tags = doc.select("img[class]");
            if (tags.isEmpty() != true) {
                for (Element tag : tags) {
                    String class_name = tag.attr("class");
                    if (class_name == "ProfileAvatar-image") {
                        return tag.select("href").toString();
                    }
                }
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return "Photo can not fund. Please check username";
    }
}

[İMAGE] Screen shot of error

HTTP状态500 - 内部服务器错误

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: org/jsoup/Jsoup
root cause

org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org/jsoup/Jsoup
root cause

java.lang.NoClassDefFoundError: org/jsoup/Jsoup
root cause

java.lang.ClassNotFoundException: org.jsoup.Jsoup
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 5.0 logs.

0 个答案:

没有答案