HTTP状态500-无法为JSP Java8,Tomcat8.5编译类 [英] HTTP Status 500 - Unable to compile class for JSP Java8, Tomcat8.5
问题描述
我有一个主要的jsp
文件,该文件使用了boxers
包中的java
类.但是,当我尝试运行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
.
I have a main jsp
file which makes use of java
class in the boxers
package. 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
.
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级:
package boxers;
public class B {
public static String voice()
{
return "HELLO";
}
}
我已经阅读了版本之间的冲突可能会导致这种情况;我的Java版本是8,Tomcat 8.5.
I've read the conflict between versions can cause this; my Java version is 8, Tomcat 8.5..
我已经查看了webapps/my_app/build/web/WEB-INF/classes/boxers
文件夹,并且有一个B.class
文件...
I've looked into webapps/my_app/build/web/WEB-INF/classes/boxers
folder and there is a B.class
file...
我想知道那些投票不足的人是否至少知道问题的答案.
I wonder if those who downvote at least know the answer to the question.
推荐答案
弄清楚了.该应用程序未正确部署. 此处帮助了我.特别是-copying web application archive file (.war)
和copying unpacked web application directory
.我的主要错误是,最初我以错误的方式应用了第二种方法-复制了由Netbeans创建的app目录中的所有文件夹(内部版本,src,web等),而仅NetbeansProjects/app_name/build/web
的内容应该已经复制到tomcat/app_name/
中.
或者只是将NebeansProjects/app_name/dist/
的war文件复制到tomcat/webapps
中-Tomcat将在几秒钟后使用文件自己创建合适的文件夹.
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
. 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/
.
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.
tl; dr:错误的部署,复制war
或web
的内容.
tl;dr: wrong deploment, copypaste war
or web
's content.
这篇关于HTTP状态500-无法为JSP Java8,Tomcat8.5编译类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!