My web application works great when testing it in the IDE, but it doesn’t work on the web server (tomcat)

I created my first web application. I set up my web server (tomcat + apache2) and tried to deploy the application on it. When I tested the application, it worked perfectly with my test environment, but when he created the war and deployed it, the following error appeared (exception):

HTTP Status 500 -

Type of exception report

message

Description The server detected an internal error () that prevented it from completing this request.

exceptions

org.apache.jasper.JasperException: unable to compile class for JSP:

An error occurred in the line: 14 in the generated java file Only type can be imported. bitcoin.BitcoinHandler allows package

Error in line: 16 in jsp: /Balance.jsp file BitcoinHandler cannot be resolved 13: double yourcoins = 0.0; 14: Random rand = new Random (); 15:
16: balance = new Double (BitcoinHandler.getBalance ("give")); 17:
18:
19: if (balance> 2.5)

StackTrace:   org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)   org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)   org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)   org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)   org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)   org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)   org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)   javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note Apache Tomcat/7.0.27. Apache Tomcat/7.0.27

, WEB-INF/classes. , !?? -, , ?

,

<%@page import="bitcoinmonitor.BitcoinHandler"%>
<%@page import="java.util.Random"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% 
double balance=0.0;
double yourcoins=0.0;
Random rand=new Random();
balance=new Double(BitcoinHandler.getBalance("give"));
+3
3

- , line: 16 in the jsp file: /Balance.jsp , . , BitcoinHandler, , Balance.jsp

0

, . , , , .

JSP, . JSTL , , JSP . , 90- .

0

The problem was the JSP subdirectory. Now I put the JSP in the root directory and finally works like a charm.

0
source

All Articles