简体   繁体   English

HTTP状态500-无法为JSP Java8,Tomcat8.5编译类

[英]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/webappsNebeansProjects/app_name/dist/将在几秒钟后自己创建带有文件的适当文件夹。

tl;dr: wrong deploment, copypaste war or web 's content. tl; dr:错误的部署,复制粘贴warweb内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTTP状态500-无法为JSP编译类:用于使用jsp mongodb - HTTP Status 500 - Unable to compile class for JSP: for using jsp mongodb 出现“ HTTP状态500-无法为JSP编译类”错误 - Getting “HTTP Status 500 - Unable to compile class for JSP” error HTTP状态500-无法为JSP编译类,该方法未定义 - HTTP Status 500 - Unable to compile class for JSP, The method is undefined HTTP 状态 500 - 无法为 JSP 编译类,重定向到操作 - HTTP Status 500 - Unable to compile class for JSP, redirect to an action HTTP状态500-无法在Eclipse Luna中编译JSP的类: - HTTP Status 500 - Unable to compile class for JSP: in Eclipse Luna Http 404 错误与 Java Tomcat8.5 Maven 和 IntelliJ - Http 404 error with Java Tomcat8.5 Maven and IntelliJ 我的自定义jsp标记库抛出错误HTTP状态500-无法为JSP编译类 - My custom jsp tag library throws an error HTTP Status 500 - Unable to compile class for JSP HTTP状态500-无法为JSP编译类:导入无法解析为一种类型 - HTTP Status 500 - Unable to compile class for JSP: import cannot be resolved to a type eclipse,maven,tomcat:http状态500无法编译 - eclipse, maven, tomcat: http status 500 unable to compile HTTP状态500-为RESTful Web应用实例化Servlet类Tomcat 8.5时出错 - HTTP Status 500 - Error instantiating servlet class Tomcat 8.5 for RESTful web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM