[英]HTTP Status 500 - Unable to compile class for JSP Java8, Tomcat8.5
I have a main jsp
file which makes use of java
class in the boxers
package. 我有一个主要的jsp
文件,该文件在boxers
软件包中使用了java
类。 But when I try to run jsp
, the following error occures: HTTP Status 500 - Unable to compile class for JSP:in the jsp file: /web/date_info.jsp boxers.B cannot be resolved to a type
. 但是,当我尝试运行jsp
,会发生以下错误: HTTP Status 500 - Unable to compile class for JSP:in the jsp file: /web/date_info.jsp boxers.B cannot be resolved to a type
。
date_info.jsp date_info.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<p><%= boxers.B.voice()%></p>
</body>
</html>
B class: B班:
package boxers;
public class B {
public static String voice()
{
return "HELLO";
}
}
I've read the conflict between versions can cause this; 我读过版本之间的冲突会导致这种情况; my Java version is 8, Tomcat 8.5.. 我的Java版本是8,Tomcat 8.5。
I've looked into webapps/my_app/build/web/WEB-INF/classes/boxers
folder and there is a B.class
file... 我查看了webapps/my_app/build/web/WEB-INF/classes/boxers
B.class
文件夹,这里有一个B.class
文件...
EDIT: I wonder if those who downvote at least know the answer to the question. 编辑:我想知道那些投票不足的人是否至少知道问题的答案。
Figured it out. 弄清楚了。 The application wasn't deployed correctly. 该应用程序未正确部署。 The deployment process, described here helped me out. 此处描述的部署过程对我有所帮助。 In particular - copying web application archive file (.war)
and copying unpacked web application directory
. 特别是- copying web application archive file (.war)
和copying unpacked web application directory
。 My main mistake was that initially I applied the second method in the wrong way - copied all the folders in the app directory, created by Netbeans (build, src, web etc), while only NetbeansProjects/app_name/build/web
's content should have been copied into tomcat/app_name/
. 我的主要错误是,最初我以错误的方式应用了第二种方法-复制了由Netbeans创建的app目录中的所有文件夹(build,src,web等),而只有NetbeansProjects/app_name/build/web
的内容应该已复制到tomcat/app_name/
。 Or just copy the war-file of NebeansProjects/app_name/dist/
into tomcat/webapps
- the tomcat will create the appropriate folder with the files himself seconds later. 或者只是将NebeansProjects/app_name/dist/
的war文件复制到tomcat/webapps
中NebeansProjects/app_name/dist/
将在几秒钟后自己创建带有文件的适当文件夹。
tl;dr: wrong deploment, copypaste war
or web
's content. tl; dr:错误的部署,复制粘贴war
或web
内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.