**HTTP Status 500 - Unable to compile class for JSP: **
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [14] in the generated java file: [/usr/local/easy/share/easy-tomcat7/work/Catalina/paykar.co.in/jsp/org/apache/jsp/rechargeMobile_jsp.java]
Only a type can be imported. com.RechargeMobile resolves to a package
An error occurred at line: [15] in the generated java file: [/usr/local/easy/share/easy-tomcat7/work/Catalina/paykar.co.in/jsp/org/apache/jsp/rechargeMobile_jsp.java]
Only a type can be imported. com.MobileInfo resolves to a package
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:463)
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:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
There is a wrong import in your JSP file.
There is a clear message in your logs:
An error occurred at line: [14] in the generated java file:
[/usr/local/easy/share/easy-tomcat7/work/Catalina/paykar.co.in/jsp/org/apache/jsp/rechargeMobile_jsp.java]
Only a type can be imported. com.RechargeMobile resolves to a package
This means that you should have a line like following:
<%# page import="com.MobileInfo" %>
But this is a package and not a class.
Try to change it as follow for importing a package:
<%# page import="com.MobileInfo.*" %>
Otherwhise change ir as follow for importing spacific class you need:
<%# page import="com.MobileInfo.YourClassName" %>
Related
I need help!
I am trying to import a java class into some jsp files. eclipse compiles correctly, but when I start the program I get this error message:
Type Exception Report
Message Unable to compile class for JSP:
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [14] in the generated java file: [C:\xampp\tomcat\work\Catalina\localhost\examples\org\apache\jsp\webproject\WebContent\index_jsp.java]
Only a type can be imported. sito.progettoweb resolves to a package
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:536)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:660)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
**Hello,friends. I met a problem when I try to visit the jsp page .
my jsp import some jars
<%# page import="org.jfree.data.general.DefaultPieDataset,org.jfree.chart.ChartFactory
,org.jfree.chart.JFreeChart,org.jfree.chart.servlet.*" %>
Tomcat debug display :**
Servlet.service() for servlet [jsp] in context with path [/Test] threw
exception [Unable to compile class for JSP:
An error occurred at line: [14] in the generated java file:
[/Users/JinCan/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/Test/org/apache/jsp/jfreeChart_jsp.java]
Only a type can be imported. org.jfree.data.general.DefaultPieDataset
resolves to a package
An error occurred at line: [15] in the generated java file:
[/Users/JinCan/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/Test/org/apache/jsp/jfreeChart_jsp.java]
Only a type can be imported. org.jfree.chart.ChartFactory resolves to
a package
An error occurred at line: [16] in the generated java file:
[/Users/JinCan/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/work/Catalina/localhost/Test/org/apache/jsp/jfreeChart_jsp.java]
Only a type can be imported. org.jfree.chart.JFreeChart resolves to a
package
An error occurred at line: 20 in the jsp file: /jfreeChart.jsp
DefaultPieDataset cannot be resolved to a type
I have already put the jars in WEB-INF/lib
how do I change ?
Use (more readable) for SO:
<%# page import="org.jfree.data.general.DefaultPieDataset" %>
<%# page import="org.jfree.chart.ChartFactory" %>
<%# page import="org.jfree.chart.JFreeChart" %>
You can only import a type, so this will not work:
<%# page import="org.jfree.chart.servlet.*" %>
And make sure jfree library is included:
<!-- https://mvnrepository.com/artifact/jfree/jfreechart -->
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.13</version>
</dependency>
I'm getting this error in MyEclipse and working on Struts 2 framework
Exception:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 17 in the generated java file The return
type is incompatible with JspSourceDependent.getDependants()
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
when i run my jsp at local host it works fine but when i run at server it show me the error.
I have post the error below. Please help me out.
HTTP Status 500 - Unable to compile class for JSP:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [14] in the generated java file: [/var/lib/tomcat7/work/Catalina/localhost/UploadFile/org/apache/jsp/Jsp/ReviewQuestions_jsp.java]
Only a type can be imported. javax.websocket.Session resolves to a package
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
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:657)
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:727)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52 (Ubuntu) logs.
Apache Tomcat/7.0.52 (Ubuntu)
I have a Login.jsp page.When I try to run it on server I get the following error:
type Exception report
message Unable to compile class for JSP:
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [1] in the generated java file:
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
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:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
What causes this error?
I found the solution I changed from Apache 7 to Apache 8 now things are working fine !