質問

package com.index;

import java.net.URL;

import com.opensymphony.xwork2.ActionSupport;
import de.l3s.boilerpipe.extractors.ArticleExtractor;

public class search_article extends ActionSupport {
/**
 * 
 */
private static final long serialVersionUID = 1L;
String article;

public String getArticle() {
    return article;
}

public void setArticle(String article) {
    this.article = article;
}

@Override
public String execute() throws Exception {

    String content = null;
    URL url = new URL("http://www.nydailynews.com/sports/baseball");
    ArticleExtractor ae = new ArticleExtractor();
    content = ae.getText(url);
    System.out.println(content);
    System.out.println("in execute");
    return SUCCESS;
}
 }

It Shows following error : HTTP Status 500 - java.lang.reflect.InvocationTargetException

役に立ちましたか?

解決

An HTTP error of 500 to 599 (although only very few numbers are actually used) is different from the more known 4xx errors.

The 4xx errors indicate that YOU as the client have done something wrong and you should modify your request, so that the server can fulfill ist - the most prominent error is 404 web page not found (more precise object not found).

A 5xx error on the other hand indicates a server error. That means, you probably did everything right, but the server is unable to handle your request.

With 4xx errors you could continue issuing your request till the end of all days, it won't work. With 5xx errors it could, at some point, work - examples include heavy load on the server typically resulting in a 500 (internal server error).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top