Tomcat 8.5.23을 사용하여 응용 프로그램을 실행하려고하는데 반복해서 같은 오류가 계속 발생합니다. 내가 바람둥이를 시작하고 로컬 호스트를 열려고 할 때마다 HTTP 상태 500 오류가 계속 발생합니다. 다음과 같은 오류입니다. org.apache.jasper.JasperException : [19] 라인에서 JSP 페이지 [/index.jsp]를 처리하는 중 예외가 발생했습니다. 그리고 여기 내 파일 (index.jsp를하고 IntagramWB.java)HTTP 상태 500 - java 파일에서 메소드를 호출 할 때 오류가 발생했습니다.
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Web Services">
<meta name="keywords" content="JSP, Bootstap, HTML5">
<!-- including the jQuery file to the bootstrap -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- including the bootstrap file -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<title> My Restful API</title>
<body>
<%@ page import = "com.mywebservices.InstagramWB" %>
<% InstagramWB insta = new InstagramWB(); %>
<% String details = insta.getDetails(); %>
<script>
var name = JSON.parse("<%= details %>");
document.getElementById("name").innerHTML = details.data.full_name;
</script>
<h1 id = "name"> </h1>
<h2>Last place: </h2>
</body>
</html>
내가 자바 클래스의 메소드를 호출하는 것을 시도하고있다. 여기 내 자바 파일 :
package com.mywebservices;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class InstagramWB
{
public InstagramWB()
{}
public static String getDetails()
{
// Variable for the access token
String accessToken = "269891473.1677ed0.a60ed893764d4c5";
String replyInsta = "";
String jsonInsta = "";
URL url;
HttpURLConnection connection = null;
InputStream is = null;
try
{
// Endpoint to get the details of the user
String endpoint = "https://api.instagram.com/v1/users/self/?access_token="+accessToken;
// establishing the connection to the endpoint
url = new URL(endpoint);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.connect();
is = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((replyInsta = reader.readLine()) != null)
{
jsonInsta = replyInsta;
}
}
catch (Exception e)
{
e.printStackTrace();
}
return jsonInsta;
}
}
또한 여기 내 폴더 구조가 필요하다면.
및 예외 : 당신의 스택 트레이스의 '근본 원인'섹션에서
수업을 컴파일하고 배포 했습니까? 그것은'WEB-INF/classes' 폴더에 있어야합니다. –