在 servlet 中实例化核心 java class 时出现 404 错误

Getting a 404 error when instantiating a core java class in a servlet

我正在 Java 中构建一个 Web 应用程序,当我尝试从 servlet class 实例化核心 java class 并使用该 java class 的方法时 class,我收到 404 错误。找了好久都没找到。

代码: 小服务程序 Class:

public class SupportPage extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    PrintWriter out = response.getWriter();
    // When i remove this part, the app runs fine.
    JiraRest jiraRest = new JiraRest();
    String key = null;
    try {
        key = jiraRest.createissue(12403, 10000, "test", "test");
    } catch (JSONException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    } catch (HttpException e) {
        e.printStackTrace();
    }
    out.println("<html>");
    out.println("Ticket with key: "+key +" created");
    out.println("</html>");
    return;
}}

Java Class:

public class JiraRest {
public String createissue(Integer projectid, Integer issuetypeid, String summary, String description)
        throws JSONException, IOException, URISyntaxException, HttpException {
    JSONObject fields = new JSONObject();
    fields.put("project", new JSONObject().put("id", projectid.toString()));
    fields.put("issuetype", new JSONObject().put("id", issuetypeid.toString()));
    fields.put("summary", "test");
    fields.put("customfield_10004", "testdvf");
    //fields.put("description", "this is a test.Kindly ignore!");

    JSONObject issue = new JSONObject();
    issue.put("fields", fields);
    System.out.println(issue);

    StringEntity se = new StringEntity(issue.toString());
    se.setContentType("application/json");
    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost("https://jira.endurance.com/rest/api/latest/issue?os_username=abc&os_password=xyz");
    post.setEntity(se);
    post.addHeader("Accept", "*/*");
    post.addHeader("Connection", "keep-alive");
    HttpResponse response = client.execute(post);

    String json_string = EntityUtils.toString(response.getEntity());
    System.out.println(json_string);
    JSONObject obj = new JSONObject(json_string);
    return obj.getString("key");

}}

Java Class 正在进行 REST 调用。 URL 我正在尝试访问:localhost/ProjectName/support。 当我删除 SupportPage class 中的 JiraRest class 用法时,它工作正常。 感谢任何帮助。

编辑:添加 StackTrace http://pastebin.com/fdXmghU5

确保您已将所有必需的库和依赖库打包到 WAR 文件中,或者只需将它们复制到容器共享库文件夹下。

你的堆栈说你错过了一些 library/class,东西......