无法编译jsp类

时间:2015-10-13 10:19:18

标签: java jsp tomcat

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

1 个答案:

答案 0 :(得分:1)

JSP文件中导入错误。

您的日志中有一条明确的消息:

  

生成的java文件中的行:[14]发生错误:   [/usr/local/easy/share/easy-tomcat7/work/Catalina/paykar.co.in/jsp/org/apache/jsp/rechargeMobile_jsp.java]   只能导入一种类型。 com.RechargeMobile解析为包

这意味着您应该有如下所示的行:

<%@ page import="com.MobileInfo" %>

但这是一个包而不是一个类。 尝试将其更改为以下导入包:

<%@ page import="com.MobileInfo.*" %>

其他,如果您需要导入空间级别,请按以下方式更改:

<%@ page import="com.MobileInfo.YourClassName" %>