parsecer
parsecer

Reputation: 5106

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. 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

 <%@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:

 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..

I've looked into webapps/my_app/build/web/WEB-INF/classes/boxers folder and there is a B.class file...

EDIT: I wonder if those who downvote at least know the answer to the question.

Upvotes: 0

Views: 666

Answers (1)

parsecer
parsecer

Reputation: 5106

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: wrong deploment, copypaste war or web's content.

Upvotes: 1

Related Questions